CT53733

Blythe and the Two Guilds

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Blythe the auditor watches over the gull cliffs of Screech Point's stores of canals. 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 <= 3797; 0 <= m <= 7594; self-edges make the answer NO.

Example 1:

Input: 1916 767 125 722 1283 1433 1039 1638 823 1358 104 1185 170 1753 424 1506 340 664 1452 1558 979 1197 328 1896 1615 1666 650 1174 581 1416 832 992 331 767 639 1175 1151 1411 96 1200 520 1796 715 1363 861 1256 898 1702 188 512 976 996 1016 1592 634 1793 614 1610 1080 1192 963 1315 198 315 1331 1626 693 1045 263 1651 191 352 919 1185 541 797 786 1887 145 794 143 698 976 1332 77 1807 549 1356 59 159 841 1719 857 1069 1525 1911 416 1721 428 962 330 1418 208 1867 190 1207 1100 1701 318 1036 942 1382 531 699 559 1179 467 838 205 1715 1540 1600 745 1651 204 343 1571 1640 64 159 606 1683 1511 1730 628 1094 158 1673 17 942 92 503 615 1769 1150 1327 216 1075 935 1716 243 540 594 1006 156 945 1456 1742 18 1555 1303 1565 1029 1060 412 636 311 1103 1014 1806 332 1377 232 1250 690 1665 175 497 1161 1798 1…
Output: YES

Example 2:

Input: 3646 5481 1 2 2 3 1 3 2497 3580 1149 3025 1438 2448 125 1692 1615 2993 267 1025 947 1928 1500 2961 2183 3218 2284 2795 1049 3205 425 1488 2087 2993 1402 1559 575 2412 1693 2607 2765 3274 15 3171 457 773 1393 3632 294 1966 789 1080 399 902 41 2641 2296 2644 985 2718 418 3331 1648 2551 1006 3491 610 2412 248 2922 1472 2871 927 2382 1543 1946 847 1473 737 2899 6 922 729 3627 672 3574 1903 2104 203 1089 1823 3027 3307 3585 192 2518 1782 3346 1045 1683 1911 2422 1494 2069 665 3537 740 1597 304 1958 3108 3220 194 2641 648 2577 2443 3131 1512 2242 1982 2964 210 1668 282 2090 1514 2124 521 2958 1219 3260 133 609 311 484 1904 2752 3156 3393 911 1158 2506 3426 1004 3055 3077 3560 1971 3592 1154 2106 424 3018 2253 2519 1316 2991 2039 2274 1060 2204 2939 3507 2731 2761 1474 2001 1479 2161 587 839 2738…
Output: NO

Example 3:

Input: 2954 3093 1 2 2 3 1 3 1601 2631 552 1340 825 2257 1147 2752 507 2005 2002 2368 306 1435 175 1990 358 2386 1229 2634 905 2067 850 1040 132 2942 2249 2810 1413 2219 714 2296 2764 2928 2152 2359 1131 1565 1580 1760 849 972 1076 2826 1264 2351 1303 1486 2317 2400 1697 2505 865 1207 1849 2919 150 1160 141 2327 658 1650 1618 2887 871 1812 1741 2795 420 976 2652 2863 683 1936 508 1908 225 1100 1038 1451 1446 2680 900 1926 1164 2390 403 2326 2043 2664 1515 1873 1122 1422 1816 2678 2175 2765 1023 1855 487 612 254 945 243 2720 188 844 569 570 192 2647 1562 2029 1086 2649 641 2902 1863 2504 571 1681 1560 1875 816 1848 825 2855 2329 2659 2094 2142 124 2856 304 706 23 1541 910 2216 522 1946 2850 2922 271 2529 2674 2850 2422 2883 155 1366 2198 2409 1671 2866 1187 1627 842 1121 2098 2233 424 2620 476 697…
Output: NO

Constraints:

1 <= n <= 3797; 0 <= m <= 7594; self-edges make the answer NO.

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