CT46628

The Lazy Two Guilds

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Deep in the floating docks of Skyharbor, Farmer studies rows of routes entries. One clean number will settle the guild's oldest argument. 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 <= 1550; 0 <= m <= 3100; self-edges make the answer NO.

Example 1:

Input: 1312 2021 463 702 300 330 275 389 245 850 362 1055 243 482 810 1155 80 113 127 1182 204 1248 1088 1290 210 1092 144 984 481 503 630 637 1141 1186 1141 1224 891 1302 3 1051 347 598 577 1036 49 1024 813 884 420 835 60 219 657 1088 453 821 447 949 472 603 602 808 1232 1249 76 299 256 1169 27 382 329 1015 651 764 124 386 28 154 1125 1295 105 1191 73 563 336 723 122 564 515 912 380 1034 492 1045 176 345 155 358 47 463 205 422 34 717 517 657 741 1257 59 346 467 1017 209 337 866 1094 794 964 168 1234 429 1028 651 795 750 1291 702 909 759 834 29 919 844 852 858 1073 580 1270 220 222 526 1243 61 1282 812 842 719 770 320 731 391 611 118 1049 476 1278 842 1059 95 1187 92 658 700 1199 634 1153 79 1041 339 857 301 1161 26 764 826 1130 354 758 525 898 720 886 9 358 357 537 223 1311 506 695 728 1224 17 2…
Output: NO

Example 2:

Input: 1034 3098 337 1012 217 281 357 783 132 887 351 652 68 201 73 716 278 1015 365 737 229 629 240 1018 128 737 785 927 136 815 291 412 301 853 627 944 653 1008 150 884 289 761 41 201 126 910 110 470 121 302 350 917 549 746 387 735 829 988 138 443 142 408 431 472 408 901 289 584 231 748 700 760 293 303 268 301 37 567 313 953 219 478 225 753 343 413 363 796 51 218 282 766 238 966 115 984 472 711 29 359 226 399 781 964 54 558 45 771 441 722 443 764 731 747 60 65 760 938 287 397 982 1024 65 886 196 574 157 325 48 840 239 702 775 790 834 847 158 932 616 672 616 794 153 286 197 842 799 1025 110 245 559 878 858 955 489 940 211 289 309 506 240 651 652 724 367 721 25 531 314 953 223 640 263 689 129 138 429 434 290 766 461 711 252 899 648 891 282 598 779 979 57 719 613 1007 18 898 249 650 16 731 184 588…
Output: NO

Example 3:

Input: 1114 1334 36 681 184 434 629 1035 198 243 855 878 338 503 614 748 157 1070 450 470 382 899 464 773 365 843 694 1005 223 626 699 1055 242 1086 217 1086 59 513 167 512 151 970 595 850 596 603 128 766 119 704 36 307 14 527 142 985 489 494 336 811 334 600 7 530 34 452 57 332 261 1112 475 990 284 1005 25 1016 550 804 724 935 520 836 618 1104 537 747 178 1097 544 1065 142 705 382 551 136 798 60 597 735 786 117 463 239 669 893 938 818 993 375 673 278 346 211 283 481 1085 657 675 89 770 88 471 293 382 52 361 49 639 661 951 132 843 8 1073 155 530 19 520 762 1109 205 244 89 298 444 451 460 947 292 693 61 372 202 984 256 260 116 248 294 971 916 938 671 723 111 151 10 603 99 517 75 613 400 550 478 1100 261 554 447 504 163 585 907 1073 321 1051 151 1050 228 255 314 477 201 403 204 787 578 931 660 825 7…
Output: NO

Constraints:

1 <= n <= 1550; 0 <= m <= 3100; self-edges make the answer NO.

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