Https://ide.codingblocks.com/#/s/29725

https://ide.codingblocks.com/#/s/29725
what is the error in my code only 1 test case is not passsed

please add the problem link…

https://hack.codingblocks.com/contests/c/509/1410

https://ide.codingblocks.com/#/s/29762

i have corrected your approach and commented the changes…

you solved it in O(N*Q). i used O(N) approach to solve it. See this. Because constraints say N<10^5 and Q<10^5, but the cases were weak.

https://ide.codingblocks.com/#/s/29763