CT36956

The Will-o-Wisp Two Guilds

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Before the gates of the fen lights of Will-o-Wisp close for winter, Zoravar must finish the roads ledger - one figure at a time. 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 <= 1990; 0 <= m <= 3980; self-edges make the answer NO.

Example 1:

Input: 1693 247 1 2 2 3 1 3 513 821 241 388 35 932 1216 1434 1030 1109 519 833 22 190 242 522 1385 1527 84 246 418 648 468 921 509 1344 671 851 492 700 331 397 324 1629 261 1137 336 487 460 1350 54 1585 519 1380 622 694 567 1644 742 1301 1054 1112 891 1034 474 887 116 442 69 563 635 1508 575 1436 1421 1622 666 926 749 1042 759 1312 507 1393 208 1485 528 1130 245 1490 976 1114 444 1379 134 1403 68 369 987 1016 161 433 282 390 570 1366 80 1033 1220 1684 1293 1382 251 822 711 1004 856 1279 1253 1352 65 299 1011 1017 309 739 378 1465 875 1210 657 1228 974 1541 896 1339 724 1449 566 723 630 1636 2 780 1295 1685 197 362 742 1273 636 1374 434 1124 750 1266 385 419 269 1437 351 884 897 1166 31 430 792 1176 678 909 418 1247 303 1570 1341 1565 34 1691 1175 1405 6 762 523 1257 785 1017 578 1649 538 553 1268…
Output: NO

Example 2:

Input: 1727 3656 1 2 2 3 1 3 1258 1469 874 1230 503 1366 217 1127 110 1140 667 1523 840 1360 916 985 276 1306 1039 1525 514 1005 308 1296 162 1560 1303 1646 1215 1714 857 1598 56 1100 162 325 112 1394 83 1379 1080 1140 1434 1466 49 244 951 1056 448 1460 1080 1562 636 1643 645 1013 294 1491 193 464 854 1703 163 1521 905 1620 221 719 309 1409 744 1629 162 186 169 1724 832 1472 662 1726 170 492 1217 1720 1152 1191 940 1347 1355 1717 1057 1297 662 1178 98 1351 673 1237 1180 1367 800 1106 270 1036 1430 1447 1316 1588 774 1029 23 183 386 1606 28 304 474 1614 214 233 324 506 409 1644 1270 1613 516 1496 419 1621 1314 1635 195 908 119 1301 722 1452 1209 1373 469 1281 716 1670 326 540 162 1366 17 1445 79 1600 576 1429 40 347 536 1309 604 726 4 81 723 744 291 366 414 652 761 1513 34 1130 93 1064 475 845 331…
Output: NO

Example 3:

Input: 1878 1036 619 1038 147 1686 464 1559 29 1064 633 1810 200 245 72 682 405 988 1133 1778 150 464 8 730 12 638 619 1530 329 837 647 895 376 1258 559 1059 736 1846 614 1395 113 1391 912 1802 920 1666 621 1791 213 1149 726 1589 1182 1830 1110 1398 530 1734 439 1733 72 996 411 1508 156 941 210 1068 174 1707 399 1095 1422 1502 1092 1647 1052 1871 925 1824 847 1696 1160 1216 65 1475 790 992 441 818 64 560 97 1718 243 1063 482 509 827 1501 14 1144 926 1100 1466 1559 38 668 1430 1681 1069 1529 437 1514 242 935 850 1070 1088 1564 735 800 837 1051 420 1489 582 635 1 672 892 1811 214 1504 600 965 246 1787 576 1818 180 513 7 591 846 1386 400 843 95 1333 604 1599 445 1425 254 1625 1362 1757 89 629 414 1157 152 201 904 1315 444 1527 116 397 209 1557 887 1617 474 1118 433 827 789 1057 91 1778 525 1441 836 …
Output: YES

Constraints:

1 <= n <= 1990; 0 <= m <= 3980; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
The Will-o-Wisp Two Guilds - MEDIUM Coding Problem | CodeTikki