CT63764

Last roads of Milo

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

It is audit day at the boar woods of Tuskmore. Milo spreads the roads records across the table and picks up a sharp pencil. 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 <= 2928; 0 <= m <= 5856; self-edges make the answer NO.

Example 1:

Input: 2023 4458 729 997 547 1521 216 1684 835 1133 1480 1886 969 1201 337 1359 140 924 200 1540 404 1166 1110 1635 805 1174 1111 1892 371 1199 1130 1446 885 1708 470 1307 1423 1510 1386 1684 170 354 369 1056 1829 1859 1169 1315 306 357 280 1212 700 1788 250 1271 942 1490 1550 1879 55 963 129 1024 234 1120 1136 1950 124 1827 948 1349 188 908 1279 1729 214 218 723 1379 236 621 1090 1740 516 1989 567 813 233 903 61 97 766 1686 590 1499 802 1236 234 972 832 1521 951 1900 1107 1333 813 950 117 1865 93 766 681 821 971 1026 461 698 1388 1825 221 1959 478 772 516 1260 948 1251 1571 2000 1251 1317 1229 1562 1489 1841 1638 1959 1588 1772 781 1961 1182 1840 1394 1671 756 1379 433 1550 430 955 33 626 302 1384 532 567 367 1314 565 1859 5 456 714 1034 153 996 909 1314 184 1669 192 1211 222 1458 241 1349 1009 …
Output: NO

Example 2:

Input: 1888 1814 1 2 2 3 1 3 760 1250 314 319 1088 1689 437 1728 384 1306 1676 1688 459 788 803 946 19 1711 209 570 1447 1701 549 1085 95 1215 673 1681 187 982 309 357 884 1554 362 1371 834 915 590 1625 1314 1625 134 374 970 1531 931 1504 1047 1625 83 983 224 697 890 1315 318 1304 507 1747 922 1067 533 1500 349 1374 1404 1408 28 1210 51 761 444 1488 857 1274 150 1855 959 1824 36 422 976 1795 1032 1199 512 944 215 371 1134 1378 518 1713 925 1501 792 1153 505 699 1322 1408 892 1160 689 1003 1555 1718 60 1321 185 203 947 1640 1818 1861 367 778 221 345 211 716 256 1455 1095 1444 75 1445 258 281 1135 1390 377 1144 383 1870 868 1076 475 843 151 753 230 635 129 1576 872 1328 457 1064 190 1360 1443 1519 277 1050 113 271 1627 1751 218 1690 1179 1788 706 1507 274 657 698 1210 248 1113 958 1866 133 1546 182…
Output: NO

Example 3:

Input: 1282 1334 142 449 493 634 99 696 33 843 357 397 996 1064 736 1150 888 1181 95 694 266 300 949 971 417 536 1241 1273 542 1252 238 1089 625 1055 259 465 8 87 1007 1054 411 545 144 974 57 1109 45 487 291 657 214 571 153 561 40 873 291 1265 409 1111 35 1167 96 963 103 895 472 619 715 1257 157 1016 166 548 107 254 965 1074 492 809 686 1141 212 863 906 1203 663 1060 92 163 172 1150 280 1173 912 1047 598 1136 275 898 217 1017 151 569 585 1127 165 1156 576 1078 1081 1258 252 719 399 404 1073 1148 245 456 297 1194 1088 1219 116 976 63 1265 275 577 478 775 64 800 868 1182 423 1113 1199 1214 263 1241 1040 1090 197 1250 416 884 571 1181 248 742 179 553 895 1033 1101 1164 108 315 18 291 111 934 84 505 442 528 296 599 510 1281 831 983 170 522 146 505 213 617 250 466 545 1042 567 1036 390 769 1130 1201 1…
Output: NO

Constraints:

1 <= n <= 2928; 0 <= m <= 5856; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
Last roads of Milo - MEDIUM Coding Problem | CodeTikki