ignus deoria the great city...

Problem:-http://www.codechef.com/IGNS2014/problems/IGNUS14D/
My solution:-http://www.codechef.com/viewsolution/3475042
Can someone explain what is wrong with my algorithm or my code?

I think you should reset the values of arr for each case!
2
2 2
1 1
1 1

2 2
2 1
2 1

have u tried this test case:

1 1

1 2

1 2

2 1

2 2
for which the answer shld be YES for both the queries.

thanx @iam_the_best

@admin Plz move this ques to practice …
Thnx