CT62400

The Two Guilds Beneath Mirrormere

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Caravans arrive at the lakeside town of Mirrormere with crates of roads, and Dino the surveyor must account for every last one. 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 <= 1722; 0 <= m <= 3444; self-edges make the answer NO.

Example 1:

Input: 983 1432 157 392 196 241 377 672 802 838 63 883 336 717 85 958 36 568 217 467 202 510 511 977 92 600 245 821 688 917 204 213 470 643 233 639 592 920 481 866 408 594 39 310 621 643 306 539 411 824 236 397 17 65 182 303 361 916 36 378 42 357 240 893 477 838 596 935 285 823 5 712 682 794 367 811 276 773 744 943 552 667 644 897 480 596 425 983 83 869 257 650 209 230 680 770 258 634 735 838 47 615 78 348 209 333 23 147 56 767 436 530 357 671 660 697 229 456 268 853 70 366 189 587 166 473 614 685 12 628 359 780 217 784 666 950 232 478 335 778 363 504 108 777 402 802 237 967 291 928 446 487 745 782 436 732 11 269 914 972 134 299 582 884 258 388 180 965 518 601 214 520 149 849 95 234 55 617 359 605 768 793 124 242 129 348 109 111 457 718 282 608 53 242 524 969 718 804 132 854 318 554 290 719 640 8…
Output: NO

Example 2:

Input: 945 712 1 2 2 3 1 3 339 408 464 717 499 657 483 571 325 643 320 668 153 550 435 497 139 161 377 849 423 702 60 307 560 920 314 376 376 568 531 828 664 912 642 828 394 923 167 643 204 621 367 830 609 777 366 407 173 235 367 577 398 639 236 650 182 256 87 453 148 726 133 558 698 940 694 718 111 395 520 786 116 265 509 826 60 216 9 302 179 232 184 465 133 763 58 834 200 495 814 831 248 381 273 432 420 490 607 695 523 628 487 770 46 769 93 543 188 654 133 262 439 595 266 546 70 77 535 842 360 541 2 892 42 900 214 899 428 510 329 426 37 808 284 509 629 930 280 595 213 574 683 806 403 724 377 440 303 587 444 881 84 721 60 866 179 314 5 535 144 750 377 854 100 531 166 381 91 153 611 668 530 632 26 452 420 751 350 887 310 801 21 312 137 659 94 398 197 260 256 402 79 346 327 729 810 933 512 870 84 …
Output: NO

Example 3:

Input: 1448 1590 1 2 2 3 1 3 851 1154 320 1262 583 927 338 447 148 1278 292 778 52 906 528 542 77 101 93 841 364 1386 294 568 266 959 148 510 733 888 771 1153 574 834 346 564 815 1014 263 314 898 1025 376 931 101 667 663 737 280 1103 245 1159 1325 1330 49 910 911 1259 224 1107 671 674 30 259 850 1432 429 1009 169 1352 79 638 837 1353 763 927 589 902 793 1154 162 579 952 1283 581 994 1096 1239 545 567 613 1039 239 768 310 1039 1160 1335 169 1019 315 318 200 1299 1324 1415 209 253 1002 1024 526 779 984 1299 611 914 111 653 33 1158 312 665 525 649 1328 1372 740 1321 197 746 339 1314 1046 1221 362 1194 937 1173 348 1017 345 598 1059 1429 922 1210 282 994 769 1426 457 942 777 1067 1187 1400 1157 1321 150 909 27 1097 193 988 1103 1166 60 673 986 1203 597 825 1369 1446 306 1060 128 515 248 702 200 710 6…
Output: NO

Constraints:

1 <= n <= 1722; 0 <= m <= 3444; self-edges make the answer NO.

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