RRATING - Editorial

It’s true, they give wrong answer. Maybe, because the test data was changed in the contest.

It’s written in FAQ. Also there is practice problem for this… It can be worse - for example when you cannot use HashMap/HashSet or sorting in Java at CodeForces…

Hey, your right about the setter’s solution getting a “wrong answer”. However, I added a little code segment to it and resubmitted to check. I got a correct submission this time.
http://www.codechef.com/viewsolution/1180239

Problem with binary search is, that you have to have sorted array. Let’s assume I’ll add 100.000 elements to array and then I’ll switching command 2 and command 1, so you need something like 125.000 sorts in array with size 100.000. Sort do not need to be quicksort (0(n*log(n)), probably insert sort is better (O(n)) (I do not know something better), but it is still too slow…

If no one knows why this happened, then perhaps the admin can check the test case/s where it fails (and I’m speaking only for insertion in a treeset)

i tried using multisets but i gives me tle…can u please check
http://www.codechef.com/viewsolution/1654148

@sikander_nsit - check out your loops… and check my solution… there is still optimization required !!

4
1 10
1 20
1 8
2

Excellent and Simplest Approach to Understand! Thanks!

policy based data structure solution to rescue lives. :sweat_smile:

1 Like

when (n%3 !=0) and k<(*it), why ,we not increment it.

st[] = 1 7 9
idx = 1 2 3

we insert 6 in st;
st[] = 1 6 7 9
idx = 1 2 3 4

I am not able to understand why it showing TLE, even though I wrote an O(N log N) solution please some take a look at my solution CodeChef: Practical coding for everyone