CT38468

Curator's Two Guilds Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Before the gates of the singing sands of Echo Dunes close for winter, Curator must finish the roads ledger - one figure at a time. 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 <= 2258; 0 <= m <= 4516; self-edges make the answer NO.

Example 1:

Input: 871 1007 1 2 2 3 1 3 412 551 234 626 110 706 696 787 468 712 234 668 238 753 77 871 177 454 233 738 409 629 211 364 9 54 86 794 737 773 25 867 54 370 202 855 355 647 67 112 15 506 356 680 285 437 236 859 385 711 148 188 800 858 76 827 166 305 32 523 469 560 115 838 178 706 197 484 14 117 323 537 5 180 140 552 401 504 179 783 378 525 16 775 502 795 591 639 224 492 632 854 443 490 30 601 25 307 1 467 71 468 209 735 557 638 300 473 222 868 94 178 390 793 6 662 196 772 13 424 291 318 450 477 408 851 494 541 441 871 152 492 82 285 649 723 529 551 42 559 329 669 146 349 767 839 94 549 784 865 399 738 156 648 679 706 199 315 821 863 92 231 101 453 481 772 427 595 181 792 74 359 183 275 391 542 358 486 97 485 64 287 800 832 15 655 323 551 8 71 384 408 129 695 553 661 646 694 119 848 61 670 810 853…
Output: NO

Example 2:

Input: 154 52 1 2 2 3 1 3 71 76 24 123 82 89 10 50 57 65 98 151 44 121 16 122 67 134 108 131 64 153 137 150 5 62 26 38 100 112 10 55 80 154 44 75 54 89 28 58 83 120 32 145 35 77 92 154 12 150 31 134 2 109 80 125 41 78 10 95 87 109 29 152 19 27 111 144 42 149 13 35 49 104 124 141 107 126 85 97 17 121 8 149 14 99 41 47 16 36 96 120 26 106 74 119 23 39
Output: NO

Example 3:

Input: 934 1434 1 2 2 3 1 3 63 359 581 606 356 460 374 476 410 622 494 766 620 653 571 907 618 889 382 637 523 687 619 800 336 388 678 870 373 928 261 426 355 455 110 365 349 828 278 505 596 912 94 639 12 385 657 677 755 919 252 864 48 811 533 736 296 318 429 489 328 676 676 689 578 670 140 505 178 721 312 763 77 840 285 329 327 680 97 468 39 634 497 796 17 37 525 554 29 65 784 809 579 887 275 465 49 904 408 872 67 602 270 861 339 458 111 756 58 681 194 793 43 613 410 565 45 256 222 769 867 899 140 219 654 802 188 521 236 796 17 33 226 490 175 807 52 562 404 834 288 753 241 698 132 685 793 837 595 879 72 794 646 829 238 336 335 682 230 397 73 123 107 851 541 654 257 923 189 786 4 485 198 555 118 686 227 555 458 507 60 912 850 876 803 856 123 513 342 456 55 738 136 326 575 873 683 691 355 875 668 …
Output: NO

Constraints:

1 <= n <= 2258; 0 <= m <= 4516; self-edges make the answer NO.

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