CT53960

The Two Guilds at Glowfen

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The council of the lantern district of Glowfen pays by the answer, and Kavi intends to earn it. First: the full register of tunnels. 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 <= 3010; 0 <= m <= 6020; self-edges make the answer NO.

Example 1:

Input: 2771 3706 597 2160 2454 2767 894 1751 243 2668 148 2658 253 1411 935 2029 297 1818 120 2257 310 2289 227 674 2461 2751 1458 1843 1179 2486 2043 2525 2528 2603 269 441 1119 1633 1115 2426 1926 2078 1812 2406 1281 2611 396 2483 1076 1552 1593 2362 1726 2711 203 1033 68 1996 1810 2654 2216 2490 274 425 534 1796 46 84 774 2674 1533 1671 1107 1911 2618 2658 1994 2470 347 1406 990 2122 1711 2297 408 887 1911 2545 1109 1653 1511 1882 578 1420 98 208 1096 2207 591 647 1036 2114 742 1426 71 1268 110 646 1759 2405 901 1567 1306 2086 1304 2607 630 1461 1379 2256 1555 2623 1053 2531 1265 2657 1206 2019 907 2126 297 2301 473 2720 788 1390 1769 2622 457 1973 1046 2090 89 872 1574 2194 685 1535 230 581 702 1333 792 1614 465 938 192 1576 429 779 2493 2534 616 1854 1158 2571 457 1668 990 1189 603 2554 1730…
Output: NO

Example 2:

Input: 2598 782 265 2551 47 1394 1560 2047 114 1855 671 1311 747 815 317 2497 780 2339 1458 2073 427 2488 158 1285 707 1266 799 1705 1559 1922 892 1353 611 2470 570 1584 188 1621 1734 1759 308 2220 2211 2405 1691 2073 378 433 298 730 1714 1730 51 168 752 1551 550 2490 1871 1893 261 2063 1951 2533 87 2201 489 1381 1134 2540 503 2354 373 2068 893 2205 518 822 250 316 2118 2226 661 1245 615 1628 23 991 1739 1898 1262 1293 381 2300 295 491 315 1844 398 2552 1817 2018 1391 1835 253 2173 48 1297 748 2042 207 465 38 305 469 2254 1658 2450 711 1306 2297 2485 1058 2553 2219 2337 34 1878 1232 2511 378 2274 25 2127 625 2405 338 2335 345 1459 1536 1550 769 2117 2035 2223 691 1887 695 2501 784 2482 1008 1808 1253 2221 464 719 1000 2449 1114 1826 607 1941 146 150 130 305 1021 1817 1394 2517 1503 2132 106 1893 …
Output: YES

Example 3:

Input: 1196 2 257 308 22 661
Output: YES

Constraints:

1 <= n <= 3010; 0 <= m <= 6020; self-edges make the answer NO.

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