CT35668

Vani's Pearl Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Legend says the vault under the observatory of Starfall opens only for a perfect tally of tunnels. Vani means to find out. 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 <= 2335; 0 <= m <= 4670; self-edges make the answer NO.

Example 1:

Input: 1256 2045 1 2 2 3 1 3 276 315 577 587 608 1245 23 696 1016 1019 544 695 234 1217 435 1124 874 906 735 998 464 1186 277 821 13 393 513 536 129 796 325 1159 796 917 619 806 706 995 3 397 211 345 602 1212 287 604 373 445 212 267 475 969 308 1097 256 905 471 1241 314 788 21 933 509 617 83 764 537 845 158 648 531 1121 541 814 834 915 306 515 459 559 313 547 518 543 487 1059 802 1118 195 1054 119 1054 6 397 408 1073 480 825 696 1216 89 831 168 493 279 900 300 709 240 556 284 710 96 696 814 834 850 992 217 1019 101 436 159 401 360 1214 290 806 105 579 53 151 545 608 592 715 761 1081 978 1048 1064 1178 429 1049 82 96 309 684 314 327 418 740 1 446 556 804 532 924 143 910 556 1207 647 776 208 570 722 1186 409 1025 870 1230 222 394 349 485 892 1105 671 1223 775 1091 41 667 8 520 812 1252 710 867 681 …
Output: NO

Example 2:

Input: 2325 1217 1 2 2 3 1 3 798 1184 212 892 484 1881 932 1547 95 2312 107 662 579 597 1180 2286 715 2294 1273 1444 1056 1908 720 2233 1005 1270 1138 2176 1436 2202 999 1986 534 1295 336 2070 29 895 196 816 1827 1984 414 1443 2012 2313 2169 2221 584 1193 187 697 1083 2005 378 1328 335 1338 1049 1312 1174 1663 984 1956 1035 1887 2000 2234 455 1756 380 920 713 1919 1231 1703 557 626 564 2117 510 1319 1591 1632 373 768 220 372 1342 1994 777 1624 877 1313 343 2182 980 1465 1379 1718 500 1218 1284 1501 373 1843 1421 2120 1458 2051 214 419 1465 2295 1802 2018 1629 2224 742 1119 1083 1440 100 1645 751 2288 366 553 1215 1575 1587 1860 1751 1829 666 2151 1521 1661 1460 2165 352 676 190 502 1212 2031 852 2138 229 2078 1075 2260 312 2124 1000 1892 653 1188 662 1570 1287 2051 253 999 675 1599 672 1247 868 1…
Output: NO

Example 3:

Input: 1773 4186 1 2 2 3 1 3 41 1712 660 1044 1640 1713 1041 1697 1163 1760 139 1566 730 1654 304 614 416 692 1354 1549 1060 1612 512 785 842 1281 1459 1769 249 569 519 567 710 1094 230 1300 1121 1567 172 889 408 740 14 156 93 96 1172 1698 776 1442 1112 1675 856 1123 1332 1483 1542 1746 1246 1334 1486 1549 469 1543 318 430 1103 1299 27 1504 403 1772 949 1508 972 1328 662 804 549 1665 375 1252 624 1067 652 1733 1240 1743 484 1421 598 621 1051 1451 1182 1368 245 302 19 1525 348 1550 537 1176 1039 1710 20 878 20 1221 1090 1273 1305 1334 1234 1643 1114 1373 130 1258 1329 1672 330 1513 967 1197 662 1389 1184 1672 82 1340 1081 1612 302 728 979 1355 13 618 352 690 408 929 1669 1760 980 1554 568 1714 276 1407 195 582 1497 1710 497 719 540 827 733 1451 186 1485 972 1055 1034 1194 819 1126 491 867 549 919 …
Output: NO

Constraints:

1 <= n <= 2335; 0 <= m <= 4670; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.