The Ball and Cups
Jo dikhta woh toh kabhi b nai hota h..
This problem made this fact more bold and fixed in my mind. What a problem it was. Seeing this problem I was thinking of segment trees because 10 test cases with N=10^5 array size and then 10^4 queries, a sure shot time out.
But since this problem was tagged as adhoc, it means that there was something unusual in it. When I read its editorial, I was really impressed that the sum of L and R values can create a difference.
The answer was so simple
if( l<=c<=r)
update c as (r+l)-c













