How do you guys find why you are getting the wrong answer?

check constraints, N can go upto 10^5 but you just took an array of 10^4+1. And from your code what i can see is, you are checking whether frog-A can send message to frog-B or not for each query. I haven’t tried this but I think you will get TLE because queries can also go upto 10^5.

Not Actually Mistake but:

  1. In sort function i don’t think you need to do +0
  2. long long will be always enough, though prefer int64_t if you are using cin and cout

My Solution : CodeChef: Practical coding for everyone

1 Like

Oh god I am stupid lol.

Thanks for helping out
I will make changes.

Just checked out your solution, I realise that I have a long way to go. Thank you for sharing it.

very profound :slight_smile: thanks