Hello, guys!
Today in Codeforces round 402 (Div 2) I tried to challenge this solution with a test:
5 2 1 1 1 1 1 5 5 5 5 5
So, as you can see in the code this cycle has no any check for reaching the end of the vector "v":
... while (v[j].first<0||j<r) { sum1+=v1[v[j].second]; j++; } ...
Obviously "j" will be out of the vector for such testcase and we will check whether "v[5].first<0" or not, but no any Runtime Error when trying to get nonexistent element of vector. So, as you can understand, challenge was unsuccessful. Why?