CT53516

Gita and the Tempest canals

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Deep in the crystal caves of Luminar, Gita studies rows of canals entries. One clean number will settle the guild's oldest argument. Task: Print YES if the undirected graph's nodes can be split into two groups with no edge inside a group, otherwise NO. Input format: First line: n and m. Next m lines: u v. Output format: Print YES or NO. Constraints: 1 <= n <= 1894; 0 <= m <= 3788; self-edges make the answer NO.

Example 1:

Input: 1594 428 1 2 2 3 1 3 319 1495 55 1553 1205 1413 661 927 158 951 208 661 772 1194 555 1231 656 946 693 1267 417 426 723 1239 289 1134 73 605 422 1064 389 1549 954 1555 1302 1579 207 718 904 1156 603 1357 445 1180 755 1052 708 1325 1038 1265 295 1486 673 900 360 618 195 243 474 1284 1223 1593 1039 1204 84 703 571 945 900 1394 894 1100 752 1154 495 728 96 171 1182 1369 118 295 1203 1532 787 1078 96 217 712 1427 981 1405 1308 1569 379 640 417 1168 1052 1068 384 1289 147 1244 21 262 979 1421 725 827 830 1118 306 1536 670 1462 54 213 938 1232 519 1406 252 495 274 841 742 1320 162 1410 62 694 1255 1314 289 1054 213 1530 257 538 49 1387 28 1481 874 1309 416 858 559 1050 440 1375 933 1136 1311 1530 375 852 641 1320 946 964 8 21 496 566 243 547 1017 1051 264 1005 100 459 1120 1495 61 742 423 542 901…
Output: NO

Example 2:

Input: 102 3263 27 62 34 97 4 16 60 64 16 19 21 91 27 60 12 51 62 91 31 79 61 96 61 81 12 56 3 23 53 74 17 93 22 45 26 86 27 29 16 93 52 98 11 41 21 94 25 74 84 100 62 73 7 77 55 84 1 80 36 67 41 51 46 92 9 60 17 83 14 88 4 20 22 29 21 34 71 72 74 100 34 83 16 25 3 80 80 81 9 24 4 100 19 20 3 55 59 80 35 91 62 66 33 96 16 86 56 93 19 78 6 85 24 65 8 59 39 93 73 85 23 101 25 82 56 97 34 58 23 84 19 67 11 96 81 89 30 47 68 78 78 101 70 99 17 74 53 93 20 44 63 85 36 87 35 98 6 72 28 48 1 82 96 102 25 63 7 38 60 72 59 63 11 35 30 36 35 48 16 96 2 53 20 54 46 47 69 82 36 78 30 57 17 50 53 81 4 86 38 62 21 42 11 30 78 90 28 90 30 76 38 89 29 86 15 85 44 49 90 91 41 82 50 92 34 59 1 87 95 102 42 56 38 54 72 91 62 92 46 80 26 52 5 71 60 91 87 91 93 96 57 77 29 66 19 39 41 72 2 62 24 49 57 62 37 80 11 66 …
Output: NO

Example 3:

Input: 168 3433 62 168 26 42 58 112 30 52 34 45 5 25 80 90 75 128 91 99 115 157 15 166 51 133 3 100 9 101 89 125 59 99 21 107 43 102 36 85 8 147 25 56 50 167 42 152 66 150 45 88 21 136 40 149 34 129 4 5 55 157 60 158 43 155 40 138 73 87 35 108 13 119 46 49 8 39 9 98 59 60 139 153 119 124 116 160 145 164 102 154 102 166 43 83 52 69 75 152 14 144 56 74 6 34 22 118 80 141 102 129 75 115 31 136 108 143 96 129 42 138 11 108 133 165 73 79 42 71 20 91 23 138 67 159 112 129 66 168 63 151 89 140 101 124 55 151 15 34 96 139 20 86 8 113 85 144 92 148 108 140 53 57 50 160 90 95 63 87 68 104 74 160 98 119 73 167 85 102 140 145 1 145 9 167 4 13 71 149 135 161 38 82 89 132 152 168 15 79 146 155 27 86 64 82 37 100 19 57 143 165 7 70 41 65 79 112 1 68 5 45 32 89 126 134 38 73 10 66 123 155 36 39 112 122 51 159 44…
Output: NO

Constraints:

1 <= n <= 1894; 0 <= m <= 3788; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.