CT55064

The Rootwater Two Guilds

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The harbor bell rings at the mangrove channels of Rootwater; Silas weighs the day's roads manifests and starts the calculations. 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 <= 3200; 0 <= m <= 6400; self-edges make the answer NO.

Example 1:

Input: 1119 842 664 923 16 421 468 550 693 820 719 873 1053 1093 696 814 597 1028 90 282 106 530 648 1018 405 485 919 988 483 745 193 885 789 1006 478 1049 47 1095 315 733 3 160 742 1080 104 739 42 341 49 517 484 858 19 890 686 826 778 780 522 1036 12 433 296 501 747 855 277 558 716 835 323 1075 601 914 373 1024 741 872 706 957 28 1066 231 327 129 1075 705 1033 112 263 622 679 757 925 114 572 266 748 429 559 124 586 165 787 677 841 497 776 386 621 462 511 428 943 428 627 817 921 149 247 234 624 415 1019 374 737 178 633 104 856 369 658 538 1074 128 980 495 916 583 610 934 980 776 852 43 849 201 980 92 753 9 596 159 942 925 1081 63 337 368 448 401 536 111 708 631 644 1019 1074 337 746 323 1041 493 572 392 1061 517 880 270 937 88 648 446 609 6 825 147 500 331 915 136 901 700 1105 225 291 640 1053 13…
Output: NO

Example 2:

Input: 736 2361 175 428 50 545 381 727 144 530 190 642 203 341 396 576 370 384 175 291 36 456 88 108 612 683 20 594 439 654 25 502 369 630 46 615 372 647 319 498 143 506 410 506 519 713 325 632 265 441 373 669 235 343 112 264 49 488 27 501 201 215 13 375 304 409 349 414 410 633 366 607 359 638 46 424 143 735 445 552 312 526 5 231 400 680 513 665 497 579 219 655 395 470 53 388 89 622 505 550 87 256 616 655 84 263 128 528 170 438 521 536 368 635 268 364 40 668 226 370 252 316 492 642 587 648 250 481 435 647 351 423 46 733 509 587 230 529 577 718 60 555 664 722 27 688 135 369 459 635 556 636 149 195 164 179 223 433 452 505 185 533 9 398 316 379 316 404 179 239 198 567 350 527 291 456 23 472 359 367 216 239 478 621 73 649 424 631 561 684 251 414 167 346 133 514 33 655 459 561 14 230 396 558 154 434 3…
Output: NO

Example 3:

Input: 1202 3332 1 2 2 3 1 3 279 1018 617 954 210 752 271 818 181 821 13 1111 370 837 669 984 115 685 215 457 525 978 56 219 116 555 233 1154 233 860 228 780 133 232 219 395 422 611 323 988 589 947 407 554 373 822 67 367 16 38 903 1021 866 934 655 1165 100 122 798 1120 590 722 39 627 837 860 768 1146 85 347 179 273 731 735 581 1045 358 1074 288 582 90 575 23 857 201 522 135 411 109 118 651 802 548 783 224 1091 111 285 676 973 88 425 100 435 256 1178 249 618 539 1157 149 915 649 878 302 971 619 1003 94 684 18 378 56 856 1114 1160 104 422 483 791 89 1161 448 462 239 402 372 441 517 748 685 1035 155 702 11 899 92 1005 500 826 1041 1182 101 851 104 295 116 873 579 985 568 1140 121 344 381 1194 398 588 556 739 255 976 1020 1021 418 526 212 1089 1028 1161 826 882 276 722 504 901 218 881 424 1122 106 24…
Output: NO

Constraints:

1 <= n <= 3200; 0 <= m <= 6400; self-edges make the answer NO.

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