CT61485

The Two Guilds at Verdantstep

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

The auditor Envoy has been asked to prepare the guildmaster's brief. 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 <= 2440; 0 <= m <= 4880; self-edges make the answer NO.

Example 1:

Input: 1613 667 1 2 2 3 1 3 3 75 669 1058 87 279 686 1581 868 1478 449 641 376 942 141 683 417 524 544 918 1191 1389 624 641 356 1451 271 1068 209 564 352 1308 1197 1413 629 673 472 1397 902 1545 623 1449 149 266 472 1045 453 924 671 798 1029 1489 56 435 187 785 6 1058 1354 1427 58 1591 331 828 14 840 501 701 375 1533 751 752 472 1609 1340 1392 74 775 190 1523 769 985 15 1317 73 903 622 1217 230 888 573 1374 823 1407 1265 1550 1215 1251 647 1393 312 1053 1276 1601 1155 1337 705 1002 725 1389 108 810 1192 1478 445 1503 522 593 95 1267 1028 1308 89 834 739 838 522 1446 1262 1550 169 1059 689 1340 551 1070 497 879 165 1021 706 1518 205 1461 1080 1474 61 1057 1033 1275 289 945 100 1028 527 894 399 607 58 1491 114 1102 598 900 495 1133 936 1131 515 898 217 1183 190 876 923 1030 392 473 266 1556 1186 1…
Output: NO

Example 2:

Input: 1890 639 1 2 2 3 1 3 1723 1841 1582 1829 537 1636 828 1323 819 1309 332 1609 343 789 656 692 212 531 1741 1845 120 1645 325 1109 463 1270 455 520 898 1837 785 1741 716 1777 257 1209 351 1718 391 888 1496 1613 496 804 761 1100 153 1535 401 499 1773 1869 1280 1488 799 1848 919 1458 1235 1373 409 1549 1130 1364 937 1129 253 925 434 1735 676 1606 1187 1477 172 570 1132 1396 152 1752 428 592 36 456 44 1059 1463 1783 49 397 77 1491 775 965 80 948 91 1103 531 1345 914 1099 587 1771 633 1577 512 1195 270 678 374 1572 1266 1848 9 1455 457 1082 391 872 1118 1582 905 910 79 1579 673 909 1582 1692 926 1090 760 996 326 1187 933 1873 1096 1217 567 1654 315 848 376 1686 39 1147 628 1393 257 586 99 390 88 381 62 690 426 993 7 897 1196 1828 999 1695 861 1465 1291 1766 1478 1854 144 1036 1693 1711 553 948 1…
Output: NO

Example 3:

Input: 1943 4258 69 378 378 512 1196 1937 147 924 283 1602 562 659 333 1232 552 1901 676 1582 1227 1832 164 380 1277 1620 15 1744 1352 1599 491 872 86 1115 1075 1508 1210 1877 514 1224 1007 1662 135 1581 34 1649 1736 1778 901 1620 1555 1692 315 634 1222 1565 541 1525 912 1806 145 283 153 426 885 923 145 1741 608 664 568 1873 574 1909 834 956 141 1605 635 1526 1646 1851 231 1199 1415 1914 300 1902 889 1130 62 1319 1150 1503 1081 1169 286 1450 1226 1781 910 1548 1496 1763 756 809 1180 1473 127 1290 38 926 748 790 186 1385 723 1900 997 1897 261 608 35 1692 117 747 1180 1394 559 1756 85 1285 1321 1323 936 1449 798 973 44 1371 968 982 87 1817 408 676 1603 1938 142 1486 209 1700 853 1815 1333 1820 1362 1371 1348 1776 731 1465 346 1802 134 1863 414 699 1448 1835 1151 1927 456 1766 95 1825 42 1056 1151 1…
Output: NO

Constraints:

1 <= n <= 2440; 0 <= m <= 4880; self-edges make the answer NO.

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