CT65023

Vermilion corridors Two Guilds

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Jace runs the fish market at the eel marshes of Slitherwick. Today the books show a list of corridors, and the numbers must be worked out before sundown. 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 <= 2471; 0 <= m <= 4942; self-edges make the answer NO.

Example 1:

Input: 1635 1230 713 1455 997 1371 136 169 790 1246 453 1094 337 1196 394 571 695 1173 282 474 1264 1291 474 1627 175 254 598 686 75 504 574 1298 1259 1614 746 1577 53 336 402 1425 471 989 431 1071 286 1160 151 355 136 149 1137 1145 14 1351 477 483 921 1166 1116 1254 176 184 13 396 478 729 938 1402 138 897 518 924 199 224 251 380 560 986 101 834 763 1508 93 1350 560 597 707 1354 433 895 361 835 34 1279 480 772 371 1216 583 1619 537 1382 23 349 136 1204 663 931 549 631 162 281 824 1352 146 1112 1150 1176 633 1380 247 1624 1545 1630 1237 1631 208 855 1127 1224 789 1267 115 1499 328 671 172 1323 777 1288 1342 1546 823 1193 326 392 448 1559 938 1424 769 1376 440 1133 669 1242 1050 1350 800 1372 1240 1241 29 790 331 804 1085 1204 1164 1523 254 1380 1035 1387 1180 1379 137 853 284 514 1211 1503 899 111…
Output: NO

Example 2:

Input: 312 2620 46 140 253 310 23 143 269 307 31 199 106 156 111 224 30 78 4 184 211 312 79 121 212 257 176 271 79 154 126 194 120 230 47 201 82 101 155 261 2 113 48 139 33 96 47 62 68 130 101 181 34 311 20 145 10 279 155 168 75 120 169 303 241 283 153 174 192 304 199 260 68 158 84 253 51 145 76 125 223 251 23 299 10 284 56 153 239 269 87 273 56 214 32 70 132 253 213 258 34 100 171 237 226 264 203 280 290 310 45 121 39 236 78 146 152 305 64 105 60 231 8 83 7 127 139 285 200 266 74 217 85 91 142 233 61 269 115 209 176 308 213 252 18 71 75 306 57 181 22 190 232 242 157 209 59 133 103 294 195 245 144 235 233 312 21 243 61 270 38 223 8 190 96 136 111 213 129 293 203 291 99 308 188 281 137 151 198 226 95 222 267 281 147 298 228 238 140 243 27 253 213 235 7 285 213 226 26 55 33 266 58 76 85 285 133 258…
Output: NO

Example 3:

Input: 2089 2545 1 2 2 3 1 3 300 928 63 1746 1839 1864 161 499 798 1687 727 1460 236 1139 767 961 239 1327 6 927 1616 1817 224 2078 74 1851 122 783 554 815 107 1611 1581 1997 1097 1450 322 362 1629 2061 225 1263 558 1360 1077 1940 767 1557 883 1548 1021 1592 881 2054 1760 1880 375 523 437 1296 549 663 155 1385 169 1531 613 1709 1253 1384 614 1635 397 1182 945 1267 777 1888 527 1423 1125 1990 771 1912 1655 1695 664 2080 507 1977 1340 1361 925 1343 490 1934 522 1686 197 365 134 1737 576 584 1769 1843 831 1527 381 949 513 520 1117 2028 538 922 60 1342 1247 2029 342 888 357 489 490 742 799 1942 971 1055 1314 1857 1233 1912 1482 1774 558 1333 196 828 364 377 1531 1888 377 1622 316 368 59 254 535 889 178 859 62 2035 427 433 545 846 1907 2066 288 1977 3 333 120 1241 1642 1915 185 341 931 1193 1473 1694 …
Output: NO

Constraints:

1 <= n <= 2471; 0 <= m <= 4942; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
Vermilion corridors Two Guilds - MEDIUM Coding Problem | CodeTikki