CT63314

Iker and the Hidden tunnels

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

The assayer Iker has been asked to track the breeding season. On the desk lies a long table of tunnels readings. 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 <= 2800; 0 <= m <= 5600; self-edges make the answer NO.

Example 1:

Input: 899 5382 1 2 2 3 1 3 603 806 585 708 780 787 251 354 131 720 326 414 507 648 166 304 427 473 595 887 234 747 112 743 135 701 439 826 609 899 88 229 73 157 680 865 235 583 139 880 348 482 149 312 504 785 735 787 42 431 238 419 597 716 11 811 724 897 27 213 385 768 664 887 172 645 180 182 101 790 62 344 498 770 454 878 602 688 168 547 40 574 555 892 602 702 177 847 170 524 676 768 283 793 597 718 361 729 562 701 540 723 567 604 180 780 278 427 617 678 259 403 794 822 106 519 158 458 486 876 571 787 236 580 519 815 190 277 205 827 100 477 237 474 296 421 352 582 456 898 46 221 71 204 225 227 768 847 211 362 89 213 311 406 60 494 324 515 99 561 409 637 263 860 408 604 170 297 440 484 351 841 359 725 49 732 453 479 268 338 148 406 2 782 519 564 15 594 426 725 82 886 287 883 611 801 404 513 291 …
Output: NO

Example 2:

Input: 2145 4421 1204 1308 533 1740 639 1081 279 958 1534 1949 1832 1991 34 484 417 1038 70 1297 227 1019 1043 1951 1252 2106 130 2014 768 921 1456 1779 1082 1141 1021 2090 571 1961 1681 2086 1366 1596 316 1844 71 634 693 736 61 2045 369 902 123 1470 1273 1952 467 1143 406 1357 88 1742 1500 2138 817 1044 147 1194 791 1542 278 2088 990 1292 137 851 1829 1853 874 1615 1085 2141 1053 1487 1202 1212 889 1246 581 2037 221 1331 36 863 712 833 1257 1939 1486 1950 551 1628 723 2091 1192 1781 1692 2057 461 1495 301 1024 1095 1396 758 851 814 1704 795 1361 1064 1456 570 1700 1125 1718 1119 2079 1029 1966 1433 1683 201 1495 103 495 719 935 512 1279 245 1021 1386 1943 56 766 122 705 368 1669 342 1071 1354 1872 1796 2027 145 920 335 1325 1163 2073 1009 1171 986 1775 1074 1842 813 983 1249 1918 248 428 1379 19…
Output: NO

Example 3:

Input: 2609 2963 1 2 2 3 1 3 1631 2078 1579 2532 2142 2374 71 2166 198 2420 835 2248 1280 2333 1313 1766 79 1344 868 1131 660 1224 1022 1916 1143 1889 1052 1795 1520 1974 410 1913 1759 2245 805 1976 1373 2054 1175 1481 468 1615 293 2426 558 650 1205 2175 2310 2324 152 752 1878 1938 617 2163 1085 1366 315 1067 1316 2253 1163 2367 1090 2534 466 801 579 1306 572 898 1041 1772 323 2070 1028 1956 1381 1719 841 2224 44 1084 2341 2550 1938 2001 468 1410 1467 1867 2089 2288 1659 2144 1584 2005 1373 1902 277 2458 2088 2171 937 1234 565 2501 1504 2164 116 1555 2151 2447 744 2498 596 965 767 2329 491 2162 468 2165 743 842 630 1934 104 791 2357 2421 204 2083 403 2210 628 1444 660 2139 1257 1956 446 652 1022 1604 1077 2090 1006 1214 2079 2522 822 1638 2007 2524 1518 2332 472 1729 307 1087 232 1457 1087 1504 1…
Output: NO

Constraints:

1 <= n <= 2800; 0 <= m <= 5600; self-edges make the answer NO.

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