I think TC’s are weak as This submission should not pass anyway.
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