A. All Winners
Reference : Doc.1
If someone find the basic constructure, he or she can AC this problem.
Since the constructure appears repeatedly, we can get 2 conclusions :
- When m is an even :
ans(n, m) = n*m/2 - When m is an odd :
ans(n, m) = n*(m-1)/2+1
Complexity : O(T)