CT59211

The Two Guilds of Buzzwell

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Baker the store warden watches over the honey farms of Buzzwell's stores of routes. A careful computation stands between order and chaos. 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 <= 1983; 0 <= m <= 3966; self-edges make the answer NO.

Example 1:

Input: 1323 1625 1 2 2 3 1 3 43 570 760 1180 290 1232 363 1131 783 1251 258 826 246 995 296 1091 260 893 343 417 34 1157 269 983 108 1078 296 1225 1216 1278 797 1033 726 849 46 476 365 469 213 832 153 635 448 1093 603 773 161 358 281 350 463 1099 42 59 40 1281 339 868 218 301 1038 1079 319 845 993 1041 899 1008 404 733 355 1233 172 465 196 421 470 820 1040 1236 872 1023 808 809 1039 1070 535 835 568 1177 208 805 284 825 144 1180 596 601 666 1125 35 234 206 831 609 768 988 1268 452 994 8 593 399 1128 70 1278 875 1285 612 689 1006 1176 176 672 610 866 694 798 783 892 258 595 68 825 57 968 664 1126 351 1162 209 313 174 619 972 1170 427 572 669 1012 1036 1159 1025 1135 93 226 149 542 1209 1263 437 482 666 836 36 885 364 774 742 1060 79 771 437 642 491 769 318 786 82 685 4 405 693 1049 980 1193 435 11…
Output: NO

Example 2:

Input: 1888 802 1 2 2 3 1 3 619 1529 877 1016 656 1146 888 1578 1487 1696 290 977 65 867 311 463 698 1574 518 1038 203 573 1066 1732 80 863 510 1702 851 1787 210 512 506 1445 793 924 290 944 1671 1739 605 1119 825 1120 1120 1132 936 1753 1415 1635 471 1686 1105 1760 411 1655 1212 1711 857 1539 1206 1772 1459 1692 183 510 447 1246 328 622 517 1537 1059 1835 1107 1545 457 1516 18 372 319 988 398 1523 19 1236 1792 1871 58 1250 645 829 676 758 100 570 995 1057 140 1018 154 419 1404 1805 682 1123 1502 1820 730 903 1332 1455 494 553 944 1504 451 1478 516 1745 1747 1761 610 1639 1051 1755 64 1403 800 919 82 268 25 411 271 1640 401 1276 451 1030 180 1282 583 986 9 1328 1208 1441 1123 1419 194 845 561 1240 770 1248 1644 1799 867 1305 998 1072 426 904 576 1436 629 1588 328 518 60 1054 525 1582 200 419 795 …
Output: NO

Example 3:

Input: 1678 2794 766 1032 394 1129 84 482 848 1033 763 1248 856 993 104 479 173 675 169 821 840 955 49 1011 330 805 1068 1139 232 1317 1373 1653 84 87 222 686 788 819 1339 1459 460 1540 823 1649 620 1326 458 465 78 748 1047 1485 461 535 1060 1118 758 891 105 128 1584 1666 855 1157 849 1604 223 1073 1166 1662 1226 1395 30 811 214 1338 796 903 148 1651 209 1511 871 995 667 1365 537 996 69 1070 618 729 534 1239 594 1202 878 933 265 828 397 1073 265 553 788 1398 1547 1645 1557 1650 1079 1114 1088 1235 556 951 5 474 706 928 542 792 120 1045 899 1547 1266 1303 283 462 41 482 234 1201 688 887 8 889 574 1427 633 1392 97 555 119 566 447 638 1170 1491 542 1179 98 1661 813 1366 84 489 1219 1257 1012 1478 1154 1527 896 949 156 468 286 804 765 885 805 1186 178 709 961 1388 883 958 775 1135 845 1045 876 1380 7…
Output: NO

Constraints:

1 <= n <= 1983; 0 <= m <= 3966; self-edges make the answer NO.

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