What wrong with the Code?

why is my code is incorrect -“https://ide.codingblocks.com/s/94861”…
since it is correct for given test case.

Hi Ayush
Could you pls tell your logic through comments?

Also
2
4
-1 -100000 99999 100001
4
9009 1 -9008 1
Gives me Yes for both. But for 2nd case it is actually No


I have corrected your code
Problem was you were using global vector,so same vector was being used all the time, because of which answers after the first test case were coming out to be wrong

why taking vector as global variable gives me a wrong answer?

Because same vector is being used everytime
For one test case it would work fine, but for further test cases the values will be pushed to same vector. You have to use empty vector for each test case

ok doubt clear thank you very much can u watch my doubt on Online strategy problem