CT61682

The routes at Silkmead

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

The scribe Ivan has been asked to restore an old family record. On the desk lies a long table of routes 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 <= 1677; 0 <= m <= 3354; self-edges make the answer NO.

Example 1:

Input: 1510 3038 1 2 2 3 1 3 690 983 961 1504 793 1338 732 1214 887 994 112 350 420 930 108 279 1129 1215 485 1290 557 750 69 449 62 372 243 1090 488 1240 423 471 2 137 850 1210 304 1354 422 885 281 1280 405 1319 861 934 55 411 65 682 198 1038 193 892 498 1492 842 1131 1294 1490 68 1080 29 1487 194 815 130 158 187 1106 392 638 785 1331 273 783 193 620 308 1326 102 1255 929 963 1063 1244 397 446 709 789 163 281 467 912 1092 1241 973 1260 616 1164 142 381 514 784 900 1499 891 1158 738 841 167 380 488 1129 122 1148 527 881 256 631 835 1398 129 353 421 1182 654 1292 356 1205 202 511 432 1141 398 1393 347 899 1241 1332 487 586 317 1261 40 174 304 759 376 865 263 1301 660 1478 889 1414 556 1463 437 939 10 64 4 60 90 684 684 1050 554 1203 410 1389 833 909 568 756 1105 1343 266 477 404 1398 350 1409 650 …
Output: NO

Example 2:

Input: 1674 2736 150 508 73 1533 626 899 641 1028 1008 1178 949 1444 366 494 1259 1275 100 374 940 1175 989 1129 167 555 1165 1378 534 1174 645 1438 787 858 656 1468 167 782 968 1461 967 1576 976 1165 113 1432 143 700 361 1599 496 1510 211 740 625 723 467 1591 862 1626 905 1479 288 456 1111 1375 64 1096 548 661 343 1497 198 368 211 453 84 1100 407 1452 793 1001 1487 1674 496 1121 248 308 390 885 1589 1619 791 921 1155 1203 1091 1204 469 842 813 1245 742 1392 67 1193 1422 1574 505 506 945 1104 90 498 439 1023 284 300 490 1434 910 1241 766 835 618 778 1010 1403 962 1272 78 978 796 1505 416 892 605 684 1346 1362 1253 1326 1031 1609 750 1127 850 1631 8 629 866 1571 1189 1399 968 1643 295 343 125 341 749 1365 123 1573 1109 1574 896 1063 549 1187 86 1601 182 326 247 1249 658 795 204 1100 67 530 190 415…
Output: NO

Example 3:

Input: 1078 2570 389 853 26 736 11 207 714 1061 180 947 529 889 157 311 818 1025 472 601 442 937 440 887 570 1047 466 1002 7 1034 403 919 615 821 68 784 707 777 98 724 777 1048 882 936 19 288 371 869 38 389 809 1018 943 978 817 895 470 829 215 324 736 1078 401 822 425 905 828 1004 109 500 751 1004 133 450 416 1023 248 793 189 867 40 491 211 670 396 961 697 879 758 1031 484 802 170 281 185 402 666 800 240 753 91 127 118 1070 887 947 566 669 792 1009 249 738 343 370 591 656 22 235 937 1067 637 638 20 275 52 958 442 831 39 151 545 998 45 206 779 982 206 905 520 1040 167 685 769 969 381 730 179 598 422 1001 325 1017 282 1022 239 275 381 644 263 391 765 884 692 1069 235 908 686 1013 51 126 117 129 172 1044 498 944 249 729 131 987 486 505 723 1015 888 889 180 591 598 819 108 168 688 905 348 1071 435 56…
Output: NO

Constraints:

1 <= n <= 1677; 0 <= m <= 3354; self-edges make the answer NO.

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