CT58523

The Two Guilds of the Wild corridors

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

The cartographer Devi has been asked to verify the safety inspections. On the desk lies a long table of corridors readings. 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 <= 2719; 0 <= m <= 5438; self-edges make the answer NO.

Example 1:

Input: 988 2506 1 2 2 3 1 3 332 449 298 395 66 393 803 980 241 626 390 708 151 966 579 973 514 766 23 742 128 973 543 934 72 290 250 946 54 713 714 834 502 777 35 180 9 389 274 320 149 759 425 822 904 954 26 538 406 424 222 698 686 827 125 341 84 302 21 781 414 595 299 543 655 827 601 699 95 628 27 63 470 629 187 210 291 614 191 716 795 865 825 981 362 686 191 432 696 931 252 613 103 470 303 395 388 501 347 794 84 225 439 779 529 616 575 615 886 921 19 434 881 892 472 754 252 904 611 908 713 923 475 711 149 687 446 862 27 780 658 740 385 743 405 852 475 533 25 934 296 457 30 38 125 213 435 832 312 748 3 457 27 678 594 785 390 865 456 612 362 805 320 454 782 864 306 936 841 936 658 746 236 792 542 712 781 881 677 679 578 739 354 548 391 876 755 901 74 918 178 397 487 905 136 524 451 519 22 195 141…
Output: NO

Example 2:

Input: 854 5407 595 647 26 154 86 366 266 612 338 416 106 335 326 787 15 751 196 840 549 659 238 459 361 486 82 739 460 766 385 406 252 453 682 775 42 164 218 277 646 681 764 815 268 594 479 780 109 442 19 137 96 743 61 496 131 633 445 529 611 690 296 767 771 782 74 441 270 291 578 613 133 395 34 118 17 643 22 688 212 369 637 817 155 543 277 527 403 848 604 853 535 849 672 818 365 794 116 772 568 841 163 269 345 699 78 709 292 357 202 851 82 506 132 267 297 590 603 769 630 765 444 604 296 393 149 499 159 465 435 747 136 701 363 523 13 422 500 619 186 583 615 844 558 789 108 426 328 522 250 537 104 505 80 170 116 313 491 566 345 635 29 74 65 217 298 718 176 416 804 853 402 722 732 850 460 484 91 410 344 386 111 424 823 846 148 809 287 339 87 222 372 428 302 824 708 711 491 700 549 760 473 682 641 …
Output: NO

Example 3:

Input: 1270 1109 12 898 322 375 358 969 66 1200 186 1154 276 583 701 900 200 1073 119 454 31 191 735 1015 55 684 78 1175 109 725 1021 1195 1033 1252 153 247 459 674 484 569 274 524 94 549 50 1227 210 704 999 1188 845 1177 424 790 231 1035 12 1101 72 308 239 933 245 1033 671 936 771 808 379 381 169 420 549 1134 1228 1269 96 592 766 802 114 1230 258 1142 298 1123 121 451 177 1175 387 835 340 686 234 876 130 323 418 959 1112 1207 465 809 75 122 774 1155 145 1246 75 550 142 732 486 1186 909 1142 1018 1192 622 1015 61 297 217 236 211 356 749 773 445 565 403 612 736 783 718 1003 245 921 182 976 344 796 253 1059 303 984 1037 1049 258 851 238 905 476 940 434 837 116 245 794 960 789 879 256 613 98 1241 886 1112 809 1101 637 940 291 1089 708 1139 795 1217 539 1070 39 811 451 709 367 585 238 982 583 1267 63…
Output: NO

Constraints:

1 <= n <= 2719; 0 <= m <= 5438; self-edges make the answer NO.

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