Who was at fault?

I’m talking in reference to the 4th question In yesterday’s unrated event Codeathon 2021
here are my two solutions
solution1 TLE
solution2 AC
the only difference between these two codes is that in first I used long long int as data type and in the second I used int only.
I know long long int takes nearly 2x time than int for I/P, but it was clearly given in the constraints that the value could tend upto 10^9.
Now my question is who was at fault? Me who played safe as per the given contraint oor the problem setter who created such test cases.

I would say none of you :slight_smile:

Yeah I would say, it’s just your lack of experience, Using a ordered_set was easy here.
https://www.codechef.com/viewsolution/48321001

Why deque.erase() is even passing, isn’t it O(n)? Also i tried to change deque to vector in his submission and it is giving TLE.

solving problems at the time of contest and solving problems in practice are two different things, hope it make sense to you. And about my lack of experience I accept I don’t know about certain things and surely I’ll improve.