CT50705

The Two Guilds at Lantern Tor

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

In the beacon hill of Lantern Tor, Quinn the clerk keeps careful count of the roads. plan the harvest festival, every figure matters. 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 <= 2519; 0 <= m <= 5038; self-edges make the answer NO.

Example 1:

Input: 1488 3746 1 2 2 3 1 3 233 825 44 1042 587 984 438 1365 441 981 1173 1444 474 625 565 1078 1286 1344 10 492 134 570 1024 1029 744 1323 449 1262 200 722 565 1137 279 581 130 341 1356 1425 450 660 84 249 39 50 183 547 733 801 170 1069 1140 1255 687 885 278 730 49 1488 827 1000 282 983 436 939 589 639 347 1013 589 1175 346 1103 182 1007 121 855 82 550 1145 1452 1237 1380 27 726 383 1305 376 865 69 514 381 1293 1273 1351 123 362 690 907 124 968 889 965 456 470 153 1288 759 774 106 322 221 407 806 1393 526 773 346 1429 80 802 148 933 800 1410 928 1188 636 796 19 320 87 1232 226 1306 79 1177 292 1177 990 1126 784 923 764 1055 284 548 335 865 291 842 225 688 35 1279 1061 1109 1161 1328 1228 1451 829 1307 740 1191 496 833 675 1212 734 1290 339 862 736 940 1417 1444 821 1103 71 631 672 1152 1103 122…
Output: NO

Example 2:

Input: 798 2447 124 651 317 752 248 754 427 653 434 479 328 690 366 780 301 764 327 736 120 504 238 438 502 720 165 737 593 648 123 502 25 52 461 662 395 419 296 771 19 715 266 646 8 763 392 684 154 610 587 665 345 368 151 680 522 694 539 584 282 649 180 690 236 248 72 429 148 289 65 123 104 798 125 258 141 438 445 614 593 649 91 231 211 547 337 635 271 365 351 773 583 698 67 209 468 516 39 219 387 437 54 176 149 586 101 119 171 235 233 361 222 320 330 586 578 794 454 517 198 342 684 708 126 522 161 299 351 511 259 463 398 691 152 192 128 334 126 286 288 666 563 631 184 203 54 340 33 750 81 516 159 753 85 733 19 731 322 604 381 548 244 408 567 723 350 605 183 505 11 177 216 707 91 243 235 254 357 456 244 648 14 190 323 748 332 499 242 361 244 567 571 757 537 630 120 259 318 444 67 607 218 795 19 …
Output: NO

Example 3:

Input: 2431 3822 839 1582 480 1048 6 2197 1609 1687 1077 1152 314 1268 1077 1226 1292 1983 969 1840 83 1189 1573 1885 27 1310 1578 2124 606 890 1658 2423 373 2085 234 1958 671 1067 339 1419 640 1295 866 932 774 1646 1092 1962 423 667 1064 1781 1482 1913 266 2314 232 1490 950 1300 1 1906 377 1082 1098 1645 266 327 9 1181 371 564 1547 1722 38 463 781 2075 142 1956 960 1814 1265 1568 2386 2430 1269 1285 519 766 770 1025 339 796 761 1813 191 2247 730 830 845 1898 765 881 764 2173 892 1057 88 609 113 947 208 330 964 2047 59 2009 1255 1292 1837 1843 633 1664 933 2311 26 2075 1723 1895 1389 1730 577 966 352 1033 2173 2388 826 2176 484 611 2386 2409 443 1790 980 1512 105 1984 30 1538 61 886 375 1306 27 290 331 1615 65 1481 361 1674 808 2375 1172 1632 855 2225 674 704 1628 1757 1728 1999 140 1910 1230 154…
Output: NO

Constraints:

1 <= n <= 2519; 0 <= m <= 5038; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
The Two Guilds at Lantern Tor - MEDIUM Coding Problem | CodeTikki