CT61235

Theron's corridors Reckoning

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

At the honeycomb cliffs of Beeswick, Theron records each corridors in a worn leather ledger. The guild wants answers, not guesses. 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 <= 2623; 0 <= m <= 5246; self-edges make the answer NO.

Example 1:

Input: 1400 4898 1 2 2 3 1 3 668 752 169 686 47 86 36 755 782 1087 328 896 1057 1287 192 1273 436 1219 259 485 162 717 138 385 513 1193 634 781 104 433 250 710 314 601 936 1040 605 1220 279 1169 152 705 455 894 9 157 298 1239 295 938 523 1166 518 1335 225 346 294 408 861 1253 362 984 230 1262 113 1263 231 1104 70 536 750 843 336 490 53 393 1182 1309 1297 1400 107 833 256 618 238 554 298 456 81 995 222 1096 166 822 87 825 11 153 4 966 491 1246 770 931 957 1097 30 560 759 1296 1008 1145 221 684 413 1337 1166 1264 851 950 231 579 368 842 118 1131 794 964 1374 1385 211 1380 767 1235 22 179 85 722 218 1207 105 526 461 744 668 1075 467 1169 252 902 484 802 6 1299 762 1087 416 794 123 620 381 1099 250 650 464 711 597 1229 750 1072 345 998 187 986 605 1143 88 834 4 1021 485 1346 358 740 387 709 655 1395 …
Output: NO

Example 2:

Input: 2047 967 1 2 2 3 1 3 60 669 1643 1719 955 1405 1260 1581 390 1998 135 944 581 1463 1430 1493 1263 1982 1241 1350 744 1039 202 1905 522 1949 981 2032 259 1405 1121 1759 1202 1939 565 733 1250 1978 853 1838 964 1553 1505 1654 917 1770 8 1275 400 1067 1595 2014 85 1378 143 2037 66 790 131 1366 108 1643 513 1842 157 1330 230 643 570 787 871 1844 905 1012 143 896 1368 2030 269 507 463 682 187 460 770 1649 118 1757 191 1455 280 1792 1130 1527 1729 1734 465 1145 456 1792 979 1004 768 1364 446 1850 168 1015 1762 1924 708 2025 415 1975 1872 1897 146 1776 204 313 1439 1888 692 995 785 1349 599 947 819 1760 1630 1655 18 910 760 1443 174 1760 272 738 11 678 918 2038 892 2006 916 1170 309 1056 1298 1659 506 1254 63 430 1343 1820 54 1011 602 1641 1595 2002 589 1116 215 1851 753 932 814 901 67 1817 1511 …
Output: NO

Example 3:

Input: 958 2000 186 268 136 536 622 778 249 949 331 432 476 930 190 870 667 829 51 156 384 637 627 903 554 820 10 386 47 425 114 621 186 480 540 888 126 842 120 768 897 919 407 514 587 675 742 856 23 286 512 624 263 552 554 825 92 493 265 352 78 172 208 474 220 543 678 893 12 20 273 317 323 880 261 781 74 275 211 772 76 330 491 935 1 236 477 526 365 479 339 641 215 593 334 637 521 744 11 26 88 582 38 413 716 784 207 624 92 592 80 165 392 551 525 715 405 626 705 930 168 882 324 343 439 753 139 188 433 550 285 580 667 716 378 583 631 725 427 884 470 726 415 516 125 674 88 811 254 608 482 562 645 943 214 907 747 775 161 798 57 63 351 648 259 277 17 784 57 860 57 169 350 915 74 788 169 737 518 638 34 401 319 336 251 289 711 722 72 289 489 766 125 250 245 913 297 405 444 908 314 471 763 945 121 238 15…
Output: NO

Constraints:

1 <= n <= 2623; 0 <= m <= 5246; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
Theron's corridors Reckoning - MEDIUM Coding Problem | CodeTikki