Section: 2, Score: 19, Time limit per test: 30 seconds, Memory limit per test: 512MB, Input: stdin, Output: stdout
Agoda is hosting an event to promote Agoda Cash by organizing a game. The game involves badges numbered from 1 to a given max badge value. The max badge value and a target sum are determined at the beginning of each game. The game is played between two players who take turns selecting a badge. The selected badge cannot be used again. The players then add the value of the badge to a running total, and the player who first reaches or exceeds the target sum is declared the winner. The winner receives Agoda Cash equal to the winning sum.
However, it has come to people's attention that the first player always wins the game. Can you check if it is possible to make the first player always win with the given max badge value and the target sum? Assume both players play optimally.
The first line contains an integer
Each of the next
Small Input
Large Input
For each testcase, print “YES” (without quotes) if the first player wins, otherwise print “NO” (without quotes)
10
6 18
4 0
7 17
4 9
5 1
8 0
5 10
2 2
8 18
6 2
NO
YES
YES
NO
YES
YES
YES
YES
NO
YES
2
10 11
10 0
NO
YES
In the first game, no matter what badge the first player chooses, the first player will always lose. First player can choose any badge between 1 to 10. The second player has always an option to choose from the remaining card which will make the sum >= 11. For example, player one picks 1, the second player will pick 10 and the sum will reach 11, which is the winning sum and hence the second player wins. So, player one will always lose.