Code-overflow 1.2

I think TC’s are weak as This submission should not pass anyway.

bruteforce it using maps for every ‘h’
https://www.codechef.com/viewsolution/37175504

It’s just an implementation problem, store all the x_i corresponding to each h_i in a set and simple use insertion/deletion.
Code: CodeChef: Practical coding for everyone
Complexity: Size of set becomes 0 when you delete all elements. So it is O(N*log(N) + Q*log(N))

1 Like