Help in RIO3 problem

Help me in https://www.codechef.com/problems/RIO3 this problem please. I have written code in java . i am able to pass test successfully but during submission i get error.

i am new here btw,so any help is appreciated.

Try these test cases -

1)

10
1 1

2)

10 
3 2

3)

10
1 2

You’ll notice that the same numbers are being printed repeatedly, also, at times, the increasing order that the numbers should be in, is not being follwed.

You can refer to my solution in Java to undersatnd how to solve it - https://www.codechef.com/viewsolution/23741850

On a side note, this problem has weak test cases, and so O(N^2) solutions are passing, which shouldn’t ideally.

Hope this helped :slight_smile:

2 Likes