https://www.codechef.com/JUNE17/problems/XENRANK...........problem link
for sample test case i.e, (U,V) = (1,2),,,,,the rectangle formed will have only 6 points...i.e (0,0),(0,1),(0,2),(1,0),(1,1),(1,2)......and when there are 6 points only then the maximum rank should also be 6(considering each point assigned only 1 rank).......so how can the output be 8,,,,,
Asked by: Abhishek_Chaudhary on April 7, 2019, 6:34 p.m. Last updated on April 7, 2019, 6:34 p.m.
The rank of every point is pre-decided based on the rule mentioned in the problem statement. If you consider the rectangle with diagonal (0, 0) and (1, 2) - the points within the rectangle are: (0, 0): Rank 1, (0, 1): Rank 2 ,(1, 0): Rank 3 ,(0, 2): Rank 4 ,(1, 1): Rank 5, (1, 2): Rank 8 Hence, the maximum rank within the given rectangle is 8.