< Back to forum

explanation of sample output for XENRANK

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.


Enter your answer details below:


Enter your comment details below:




1 Answer(s)

avatar

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.

Shubham_Kumar_Gupta last updated on April 7, 2019, 6:34 p.m. 0    Reply    Upvote   

Instruction to write good question
  1. 1. Write a title that summarizes the specific problem
  2. 2. Pretend you're talking to a busy colleague
  3. 3. Spelling, grammar and punctuation are important!

Bad: C# Math Confusion
Good: Why does using float instead of int give me different results when all of my inputs are integers?
Bad: [php] session doubt
Good: How can I redirect users to different pages based on session data in PHP?
Bad: android if else problems
Good: Why does str == "value" evaluate to false when str is set to "value"?

Refer to Stack Overflow guide on asking a good question.