Exist_or_not Problem

I’m not able to figure out why the following code isn’t passing the test cases. I tried the code on my local machine, and it seemed to pass the custom cases.
Link to the problem: https://hack.codingblocks.com/contests/c/380/1559
Link to the code: https://ide.codingblocks.com/s/48862

Hey Harsh, there are 2 corrections in your code

  1. declare unordered_map<ll, ll> m; inside while(t--) loop.
  2. Put an if check if(q>=0) before while (q--) loop.
1 Like

why the second condition?

Hey Shikhar, there i a case in which q < 0, for that we are putting this condition.