CT49097

Chandler's Ledger of roads

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

In the mushroom groves of Fungaldeep, Chandler the bookkeeper keeps careful count of the roads. Inspect the delivered goods, every figure matters. 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 <= 2291; 0 <= m <= 4582; self-edges make the answer NO.

Example 1:

Input: 2275 4233 1 2 2 3 1 3 739 1328 757 1351 1444 2073 355 733 240 1320 185 299 740 855 2 1057 1076 1585 222 855 66 1183 252 967 534 2057 795 2009 714 1695 995 1420 518 613 260 497 1665 2134 32 372 614 746 250 1493 631 2096 412 2057 608 1754 681 1005 467 1717 1176 1422 550 1322 145 2124 1206 1887 25 1465 1348 1423 874 1811 1171 2132 221 2060 1433 1768 152 1376 486 517 283 1720 322 791 359 1210 1158 1434 150 1146 866 1899 1296 2143 250 2192 247 423 496 613 105 1409 212 1807 626 1033 445 686 361 1817 814 1981 1454 1590 621 1945 1600 1796 689 1632 313 849 144 1393 893 1128 309 1101 101 1664 280 1728 92 1695 606 612 111 837 468 1496 955 1151 57 1467 565 1122 1135 2127 1480 2127 56 1199 575 2210 281 1048 390 1068 667 1073 472 1792 797 1282 81 1712 954 1239 77 2211 863 1861 104 1725 399 1707 808 1231…
Output: NO

Example 2:

Input: 1679 3509 638 640 257 1650 958 1115 425 801 274 398 365 1605 863 991 948 1344 523 1507 1017 1433 721 1134 1453 1460 413 738 131 257 1261 1428 479 1194 243 922 425 980 148 1544 66 1073 47 271 1433 1481 785 1675 1353 1584 414 1060 461 1671 1322 1354 793 1670 269 1312 772 1034 521 664 244 540 822 1469 263 957 152 669 669 1399 143 1075 1326 1534 937 1229 728 1456 573 725 249 1449 186 1182 1016 1313 1216 1219 672 911 343 822 392 521 23 102 574 931 1379 1434 53 257 65 771 1086 1612 266 989 364 1386 309 598 140 1606 538 1373 1498 1641 395 1363 72 194 546 1349 703 1666 1477 1575 473 1356 9 1080 657 810 62 1451 195 732 93 1651 617 1574 1286 1362 886 1668 723 1636 158 1419 935 1071 88 215 1401 1567 29 646 694 1036 170 1067 1094 1237 352 1507 1 14 137 729 158 1173 340 946 163 362 192 1290 371 647 603…
Output: NO

Example 3:

Input: 1047 3663 489 775 235 771 486 809 247 444 264 992 405 593 624 840 65 222 695 949 112 451 437 520 583 682 195 222 777 1045 278 815 378 475 118 944 421 986 694 765 26 366 146 489 640 778 757 1023 28 569 838 911 1042 1047 376 630 934 965 819 834 321 951 360 879 77 425 369 752 103 606 391 779 323 476 125 731 965 995 290 904 880 943 72 142 598 965 112 732 531 833 68 810 803 900 228 673 1017 1031 244 914 213 730 66 322 758 883 625 800 26 1002 413 807 116 139 770 877 68 572 554 928 288 878 624 889 33 692 240 402 43 345 411 964 580 664 287 499 174 713 498 748 572 671 386 590 33 733 528 821 479 1035 109 562 749 988 217 312 258 991 129 148 607 616 81 153 430 569 136 534 511 562 29 265 142 273 331 552 84 602 203 563 93 325 521 578 141 545 272 1016 236 672 264 1035 207 798 512 661 217 618 463 985 188 …
Output: NO

Constraints:

1 <= n <= 2291; 0 <= m <= 4582; self-edges make the answer NO.

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