2199A.md (2200B)
1 Source: https://codeforces.com/problemset/problem/2199/A 2 3 A. Game 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 512 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 Alice and Bob are playing a card game. The game consists of $3$ rounds, in each round both players score some points (from $0$ to $k$), and for each round, Alice's score differs from Bob's score. The player who scores more points in a round is considered the winner of that round. 22 23 In the first round, Alice scored $a_1$ points, and Bob scored $b_1$. In the second round, Alice scored $a_2$ points, and Bob scored $b_2$. 24 25 The winner of the game is the one who has the higher total score. If Alice's total score equals Bob's total score, the player who won more rounds is declared the winner. Alice wants to understand if Bob has a chance to win, or if she will definitely win regardless of the results of the $3$-rd round. Help her determine this! 26 27 Please note that in each round, a player can score at least $0$ and at most $k$ points. Additionally, for each round, Alice's score differs from Bob's score. 28 29 Input 30 31 The first line contains a single integer $t$ ($1 \le t \le 10^4$) — the number of test cases. 32 33 Each test case consists of three lines: 34 35 * the first line contains a single integer $k$ ($1 \le k \le 50$) — the maximum number of points that can be scored in a round; 36 * the second line contains two integers $a_1$ and $b_1$ ($0 \le a_1, b_1 \le k$; $a_1 \ne b_1$) — the points scored by Alice and Bob respectively in the first round; 37 * the third line contains two integers $a_2$ and $b_2$ ($0 \le a_2, b_2 \le k$; $a_2 \ne b_2$) — the points scored by Alice and Bob respectively in the second round. 38 39 Output 40 41 For each test case, output NO if Alice will win regardless of the results of the third round, or YES if Bob has a chance to win. 42 43 Example 44 45 Input 46 47 ``` 48 5 49 50 6 51 52 2 3 53 54 1 4 55 56 5 57 58 3 1 59 60 3 1 61 62 3 63 64 3 1 65 66 3 1 67 68 10 69 70 0 1 71 72 10 0 73 74 4 75 76 3 1 77 78 3 1 79 ``` 80 81 Output 82 83 ``` 84 YES 85 86 YES 87 88 NO 89 90 YES 91 92 NO 93 ``` 94 95 Note 96 97 In the first example, Bob will win if, for example, Alice scores $3$ points in the last round, and Bob scores $2$. 98 99 In the second example, Bob will win if Alice scores $0$ points in the last round, and Bob scores $5$.