CT57509

The Two Guilds of Barking Cove

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

The harbor bell rings at the seal rocks of Barking Cove; Wren weighs the day's bridges manifests and starts the calculations. 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 <= 1628; 0 <= m <= 3256; self-edges make the answer NO.

Example 1:

Input: 231 725 1 2 2 3 1 3 145 215 203 204 133 188 128 229 122 225 194 209 140 185 29 94 45 66 52 170 3 87 116 198 17 165 87 99 65 79 74 160 74 169 40 215 54 61 101 212 217 231 127 171 152 171 101 140 18 164 6 205 1 135 104 126 31 194 100 150 32 33 50 111 33 136 63 227 57 64 68 213 76 210 44 185 95 107 79 96 95 111 31 213 109 124 62 226 173 185 58 221 13 190 74 177 77 126 57 75 63 155 33 167 124 158 212 216 181 207 63 173 155 207 140 167 141 172 150 218 6 134 111 138 43 123 42 196 5 44 94 197 128 130 39 202 14 113 205 217 166 194 77 88 108 176 160 183 105 157 51 155 9 211 73 173 74 96 204 209 57 94 6 162 43 145 87 153 30 224 130 193 116 155 86 192 109 111 85 133 75 180 13 56 128 149 135 199 110 193 153 209 122 228 81 139 64 127 86 129 79 180 57 179 51 212 14 161 113 148 61 99 7 147 85 152 39 151 …
Output: NO

Example 2:

Input: 221 393 1 2 2 3 1 3 156 165 111 213 36 149 57 146 55 119 48 180 21 199 42 197 50 160 85 110 54 125 45 86 41 73 6 75 99 110 36 42 26 159 128 131 51 57 10 152 90 93 73 103 90 177 3 140 2 198 55 104 147 201 13 99 122 141 94 146 135 183 156 188 24 122 83 191 142 195 45 180 94 173 7 201 7 210 19 156 67 83 123 155 155 210 86 159 132 200 42 68 135 220 20 200 137 200 160 219 150 216 57 145 33 107 38 193 46 207 49 50 4 120 103 120 39 170 154 187 1 16 85 86 180 197 98 179 2 125 55 199 112 176 45 211 78 83 126 162 27 108 22 194 109 210 3 65 143 152 151 210 77 175 134 155 53 168 35 191 121 194 81 84 43 108 52 151 29 120 34 169 15 141 150 151 19 205 125 145 21 190 7 113 77 158 20 112 186 219 86 112 162 172 95 204 81 133 28 167 113 188 132 168 93 189 55 213 154 196 19 33 92 183 77 218 18 183 6 10 31 43 …
Output: NO

Example 3:

Input: 1537 1917 1 2 2 3 1 3 1217 1311 484 1273 294 1212 533 1521 1065 1378 1454 1487 1141 1152 1133 1297 561 962 68 134 157 545 42 1447 913 1117 661 1477 548 603 88 851 565 1384 828 1233 1182 1220 22 721 401 451 157 389 1333 1472 799 1110 100 1016 1422 1464 98 948 431 917 741 858 902 1122 980 1228 657 1052 623 1244 926 1184 934 1211 552 559 683 1038 883 1252 300 1056 637 1086 337 1408 153 845 511 1452 1088 1436 221 523 405 1441 1496 1505 806 1410 793 1136 338 1508 471 492 980 1514 205 1349 163 1434 120 1282 1522 1534 170 365 1106 1119 912 1530 300 1083 859 1310 59 547 812 859 129 1226 29 1417 4 217 525 1357 158 675 935 1000 1093 1369 1096 1454 233 332 749 1412 209 761 130 1169 322 1398 300 1229 222 1419 374 1498 1255 1527 198 649 210 1160 233 1012 979 1415 316 1442 1031 1262 663 1059 58 74 732 1…
Output: NO

Constraints:

1 <= n <= 1628; 0 <= m <= 3256; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
The Two Guilds of Barking Cove - MEDIUM Coding Problem | CodeTikki