CT48918

The Wistful corridors of Captain

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Captain runs the apothecary at the clockwork quarter of Gearford. Today the books show a list of corridors, and the numbers must be worked out before sundown. 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 <= 2073; 0 <= m <= 4146; self-edges make the answer NO.

Example 1:

Input: 1628 3979 393 706 861 1610 164 1481 517 786 83 1404 225 774 30 1290 945 1412 262 1556 671 1605 97 583 604 796 849 1209 485 878 241 1457 962 1552 862 1171 117 1418 615 998 318 1239 448 823 1330 1408 149 770 550 705 441 719 1517 1628 162 368 15 1612 1076 1613 110 1370 318 495 848 1014 386 762 254 1148 76 1177 690 1549 1067 1369 22 1370 650 1551 270 1309 995 1013 692 699 338 1562 280 1505 761 1554 940 1115 668 1451 962 1353 124 1609 992 1043 24 1561 383 1286 353 1344 100 1567 186 901 300 772 674 1550 996 1527 612 1422 225 1107 302 937 1194 1402 338 970 13 352 630 1538 599 1359 233 322 120 197 956 1597 122 1300 120 341 489 1576 343 1250 1170 1409 806 943 217 640 1233 1406 901 1232 965 1378 216 319 228 855 1094 1203 36 1344 453 1223 458 1535 1213 1556 709 1365 22 983 275 1196 985 1468 100 973 5…
Output: NO

Example 2:

Input: 1220 3056 667 1175 223 380 82 1058 537 743 265 372 50 1058 22 555 265 300 581 710 217 470 708 856 354 1041 558 575 406 1031 633 766 355 797 359 768 362 700 89 963 278 863 494 1075 392 775 64 1212 953 1191 343 688 210 983 100 855 406 593 723 971 578 962 1094 1180 429 1203 322 1054 110 791 202 241 762 1042 504 995 67 146 646 1197 251 527 15 237 131 796 551 592 44 527 146 685 550 783 422 533 605 1118 439 1172 29 937 473 870 53 383 650 1210 161 754 276 643 432 536 87 358 435 1041 551 1018 588 943 296 485 74 843 212 238 865 1050 140 181 348 626 478 761 103 729 635 1142 483 683 60 457 324 389 731 1017 306 1204 214 1216 550 1142 5 1004 90 817 182 496 291 868 176 295 235 1053 11 1066 620 699 328 502 703 892 136 1104 420 1141 878 1058 11 1005 1028 1170 533 1200 500 565 292 301 448 825 166 425 786 1…
Output: NO

Example 3:

Input: 1147 2769 868 1115 910 954 152 504 70 607 15 163 334 823 1022 1062 124 436 668 968 181 389 361 962 302 890 12 174 695 812 517 540 768 901 386 625 316 1017 107 431 856 1145 246 1135 142 469 922 1085 134 788 643 677 24 208 766 776 249 1099 90 286 265 309 161 247 623 934 27 360 871 897 463 1028 453 623 562 668 115 328 51 373 644 973 135 594 163 347 325 1055 482 562 103 955 726 740 70 999 60 858 550 598 475 824 679 938 141 1137 248 707 504 993 626 801 550 685 306 573 439 588 1038 1095 275 821 32 326 357 538 662 1025 362 635 60 849 782 937 3 457 34 1065 676 861 325 394 304 701 609 1044 61 247 586 820 670 702 450 637 277 416 388 1062 833 1016 472 1000 135 620 258 544 119 487 581 772 144 1066 206 921 779 920 351 1054 292 885 715 1040 179 583 377 644 69 777 85 1046 125 228 273 312 213 269 215 375 …
Output: NO

Constraints:

1 <= n <= 2073; 0 <= m <= 4146; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
The Wistful corridors of Captain - MEDIUM Coding Problem | CodeTikki