on the problem RANKLIST (http://www.codechef.com/FEB15/problems/RANKLIST/) I have made a code that works for the sample input and some self-identified input. But I get WA on the submission, will you determine on what testcases and why will my code receive WA?
your code fails for following test cases:
(3,4)-{1,1,2} correct ans is 1
(4,5)-{1,1,1,2} correct ans is 2
(4,6)-{1,1,2,2} correct ans is 2
(4,7)-{1,1,2,3} correct ans is 1
(4,8)-{1,2,2,3} correct ans is 1
first try these test cases.your approach is correct but u have to find minimum number of operations required.
can you explain it to me then, how did it become 2?
38 should be a sum of a rank list… can you give me the sequence of rank list that has a sum of 38 and the minimum moves that can transform it to an ideal rank list is only 2
I know get it that it 1 is the answer, but on the problem, look at the sample input for 3 3, the output is 2… and there’s an explanation…
Example case 4.
Only possible rank list is {1 1 1}, You can convert it into an ideal rank list by changing a 1 to 2 and another 1 to 3 i.e. {1, 2, 3}, hence you need two operations.
this was not pointed out. I think I based my code on the sample input. my bad
OH. That was my mistake, I failed at knowing that the ideal rank list can be considered ideal even if its not sorted. Thanks, this is what I need I guess.