CT37450

Ivan's Jasper Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

It is audit day at the copper works of Verdigris. Ivan spreads the corridors records across the table and picks up a sharp pencil. 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 <= 1932; 0 <= m <= 3864; self-edges make the answer NO.

Example 1:

Input: 1922 3565 1418 1449 319 468 379 1878 820 1262 336 1585 1667 1704 1081 1133 1316 1851 308 1714 1504 1899 259 1134 1459 1724 755 1548 1671 1735 523 605 146 987 509 1642 316 1681 515 1786 198 707 341 1233 1763 1873 813 1521 989 1282 244 1023 252 843 636 1742 1226 1706 70 1692 811 978 1057 1419 1300 1906 1334 1593 125 1625 96 1655 355 1324 931 966 191 945 1596 1864 642 1430 73 400 204 1762 89 823 1000 1851 1094 1689 164 1890 1042 1847 131 1574 1259 1830 508 1100 1453 1876 1022 1143 1245 1877 397 1397 536 676 1032 1648 696 1472 1494 1870 416 421 702 1624 423 1287 805 1893 262 517 514 763 753 1015 1480 1504 3 1146 755 1672 693 1566 313 831 789 1105 378 662 99 306 240 434 726 1371 2 838 668 1611 1012 1850 563 1642 140 893 298 1081 682 940 1047 1614 253 651 625 1160 463 1794 575 1746 551 1501 1841…
Output: NO

Example 2:

Input: 1200 810 1 2 2 3 1 3 657 851 123 1183 185 1026 38 82 17 679 832 1040 84 106 440 611 34 1015 360 990 143 866 237 548 157 1086 646 1115 453 1050 76 1059 469 1042 889 1116 98 369 24 566 115 229 47 559 586 897 358 541 115 1010 164 856 977 992 143 1183 638 960 262 1112 148 1177 488 1138 277 1119 255 894 721 790 108 375 875 881 894 901 330 578 473 589 13 42 169 971 95 535 87 281 525 677 225 243 556 1116 214 438 121 502 103 381 7 894 834 854 607 1145 652 657 279 295 322 847 1071 1158 99 960 237 774 128 221 32 650 229 565 571 708 573 765 289 1165 515 912 858 1103 452 1086 411 949 99 686 209 478 834 900 716 961 143 792 620 1196 208 622 734 853 111 925 504 554 60 495 762 1120 113 962 64 327 86 717 1074 1143 794 1058 92 319 332 813 302 1148 793 1005 711 1021 734 871 554 558 279 1056 71 359 378 911 20…
Output: NO

Example 3:

Input: 251 33 1 2 2 3 1 3 69 105 117 231 76 140 15 126 195 213 144 191 12 75 186 197 223 229 135 216 89 136 21 35 104 249 212 246 83 135 63 222 125 232 61 171 63 106 178 222 94 103 24 170 71 76 144 214 6 75 142 150 21 205 18 235 19 135 11 100
Output: NO

Constraints:

1 <= n <= 1932; 0 <= m <= 3864; self-edges make the answer NO.

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