CT57971

The Ashen corridors of Sahil

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Every season at the wheat plains of Amberfield, someone must settle a dispute between crews. This year the task falls to Sahil, armed only with the corridors register. 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 <= 2985; 0 <= m <= 5970; self-edges make the answer NO.

Example 1:

Input: 1916 1078 1 2 2 3 1 3 1185 1556 1581 1704 981 1221 428 1235 581 1741 473 773 778 929 511 1373 606 1329 415 1113 1076 1144 414 1527 1089 1403 680 1228 432 1542 700 1681 676 1505 1542 1789 238 1264 208 268 812 1078 1286 1497 25 1394 1332 1450 429 930 865 1667 907 1781 989 1301 474 1227 879 1630 539 1112 12 875 1502 1809 347 685 1783 1789 1414 1636 1029 1554 575 684 692 1459 1378 1515 447 1698 1350 1890 1225 1401 845 1314 332 829 415 1538 589 1597 234 1727 694 1079 491 1540 883 1347 1102 1107 248 1394 1210 1854 296 1441 1325 1525 789 1012 446 1403 671 989 654 788 931 1197 401 796 823 1726 512 1307 1627 1814 118 1029 1416 1860 223 551 992 1452 638 1507 57 1018 254 862 98 627 284 688 691 1020 205 674 216 1821 1168 1352 1306 1697 516 892 32 941 836 1168 301 760 197 1120 528 769 1417 1544 506 157…
Output: NO

Example 2:

Input: 2041 1032 131 874 601 1885 542 1750 393 1190 1209 1668 1085 1375 244 1644 1002 1638 33 127 1434 1926 877 1701 600 1170 115 621 157 1470 1638 1979 464 1914 1081 1362 1103 1945 334 1280 175 209 725 1128 580 1239 571 1907 59 1513 6 1159 957 1406 156 1719 216 1426 716 1497 828 1829 832 1472 489 533 29 1450 1105 1588 31 416 357 1231 158 1190 947 1395 765 1831 17 2041 426 1110 103 1069 637 1677 1217 1969 200 368 1005 1680 729 1007 704 1323 451 1304 1111 1917 1026 1296 1 1089 206 511 145 768 518 1842 610 910 75 217 374 1216 1713 1719 216 747 428 1643 1430 1970 166 1611 253 717 647 1811 359 429 176 1217 245 1059 797 1421 58 470 927 1518 385 576 653 850 251 400 377 1364 153 886 569 1425 303 1107 213 500 816 1858 40 1193 159 1793 123 1117 1249 1861 586 1603 501 1486 442 900 381 1619 1072 1379 136 16…
Output: YES

Example 3:

Input: 2384 5468 967 2320 1300 1960 1615 1883 1316 1337 619 1961 268 2280 135 1309 893 1937 500 1809 943 1604 847 2370 1046 2217 176 513 1461 1756 69 1376 586 1397 305 1084 787 1660 1431 1908 333 2047 154 963 1828 2130 870 2115 825 1276 1897 1909 1359 1620 1499 1753 1797 2165 816 2321 198 1543 519 1850 55 172 1316 2189 410 1424 1011 1421 342 761 876 1076 1209 1859 843 2138 572 1158 392 510 752 2093 324 803 907 1217 423 2315 1774 2287 198 1399 386 1607 279 2308 440 1338 1224 2098 356 1501 134 826 183 1870 1795 1817 62 294 1300 1492 1283 1734 1181 1545 751 1784 209 1834 351 1455 256 1090 1295 1835 1021 1607 295 1841 1533 1974 503 1656 16 821 820 1431 240 774 525 2100 7 941 114 859 1683 2136 1387 1728 1189 2319 748 1261 1311 2026 225 429 785 1809 33 1017 816 1574 322 628 294 356 1511 1522 298 321 12…
Output: NO

Constraints:

1 <= n <= 2985; 0 <= m <= 5970; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
The Ashen corridors of Sahil - MEDIUM Coding Problem | CodeTikki