CT62863

The Two Guilds Beneath Scrollkeep

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Morning light hits the archive halls of Scrollkeep as Clerk unrolls the day's manifest of roads. The tally will decide the next shipment. 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 <= 2674; 0 <= m <= 5348; self-edges make the answer NO.

Example 1:

Input: 2459 4170 796 2064 720 2134 46 855 105 219 870 1980 37 517 349 535 2126 2403 705 1594 86 1237 458 731 850 1474 7 464 622 862 503 2255 1589 2431 70 1980 170 443 57 1344 1665 1826 905 1629 1402 2136 259 1188 984 1838 1316 1821 118 1812 162 314 601 1394 451 805 557 2432 1800 2107 778 1492 1398 1621 1174 2273 494 2369 944 2400 24 1256 1315 1501 1361 1439 811 1874 731 866 772 1754 752 2406 589 2208 646 1426 85 580 1211 1413 1137 1710 1363 2325 2217 2422 308 1118 1143 1910 760 2323 792 2045 356 2082 581 1064 700 1693 331 968 1445 1983 201 2250 741 1261 94 562 2357 2396 780 932 1973 2402 1914 2377 402 951 1073 1345 1163 1353 449 1901 692 738 19 1417 219 2166 1667 2351 727 2122 2092 2395 582 2334 670 2234 1326 2209 128 1290 1120 2018 1623 1733 1898 2186 1967 2247 161 1869 343 797 629 911 1151 1433…
Output: NO

Example 2:

Input: 2372 763 1293 1563 1096 1224 421 1892 249 1128 1337 1415 1502 2357 1537 2185 331 1414 599 815 2128 2315 495 1925 7 424 363 1624 931 2162 160 841 976 1081 809 1910 1009 1775 533 2284 498 1803 644 2287 895 1064 155 1427 838 1669 163 1969 1328 1958 146 2204 312 2071 523 1891 769 952 580 1940 763 933 247 2338 277 1585 606 899 1894 2138 745 1912 1440 1865 1458 1501 1284 1788 497 669 1412 2329 156 1701 225 1509 835 1276 492 1444 686 2266 708 874 1547 2020 847 1505 1647 2276 683 777 1257 2039 401 701 1089 2293 615 723 310 1284 2013 2248 16 1488 805 1432 1361 2065 1607 2370 425 544 1388 1427 106 1652 270 1946 122 705 339 1895 886 2117 1157 2222 1175 1331 894 1562 1873 2048 179 2032 118 1967 1117 1670 826 1833 811 1525 932 2179 1404 2328 552 690 2080 2347 1205 1329 143 1372 220 1345 1058 1893 823 1…
Output: YES

Example 3:

Input: 615 2502 391 560 549 574 442 510 476 544 2 59 448 503 79 255 130 572 143 177 326 377 33 151 154 257 228 359 127 222 274 570 133 456 95 363 8 521 32 579 430 559 134 336 449 496 109 556 383 438 32 64 2 141 42 69 130 298 190 469 137 499 328 355 94 212 346 386 334 380 251 284 324 536 112 195 31 179 205 360 96 183 391 574 361 557 132 615 73 221 94 364 525 576 33 323 156 246 20 586 209 547 338 573 232 381 86 382 332 581 128 413 170 475 338 502 304 335 537 607 23 173 140 518 51 574 117 272 240 266 224 521 102 250 48 345 374 416 145 262 588 614 29 405 165 451 142 516 195 360 325 552 198 547 166 410 357 367 331 412 144 394 187 549 8 523 177 236 427 443 525 592 90 445 75 436 231 415 237 273 495 500 156 506 88 492 1 308 556 583 285 301 130 451 305 508 64 610 173 250 400 449 376 450 100 521 90 342 144…
Output: NO

Constraints:

1 <= n <= 2674; 0 <= m <= 5348; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
The Two Guilds Beneath Scrollkeep - MEDIUM Coding Problem | CodeTikki