CT62331

The Two Guilds at Blackglass

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

The registry keeper Alaric has been asked to track down a clerical error. On the desk lies a long table of canals 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 <= 2142; 0 <= m <= 4284; self-edges make the answer NO.

Example 1:

Input: 1353 3437 1112 1187 448 700 296 1249 167 359 271 349 834 1291 52 660 385 812 30 1120 906 946 790 927 424 546 848 1291 665 1112 742 752 35 857 81 427 582 873 455 869 111 307 157 684 92 984 13 1178 696 1231 139 195 182 527 10 1096 372 898 687 1083 191 582 440 999 412 448 333 789 1036 1088 230 1325 896 1267 260 1186 212 1067 417 1066 75 381 787 817 172 1181 780 1202 884 951 89 1080 270 1022 806 1072 12 405 434 1213 184 809 895 1022 256 963 941 1167 307 359 657 839 968 1011 91 869 595 1142 57 650 136 1325 518 954 12 644 927 1034 26 1048 778 1154 128 306 16 692 121 252 439 1177 4 429 182 872 893 1125 587 806 63 1155 993 1070 198 608 562 614 906 1090 289 989 310 995 576 993 65 306 194 823 1118 1259 204 901 384 1157 329 1079 196 1046 1015 1189 306 748 280 1078 111 334 393 539 204 355 367 856 809 …
Output: NO

Example 2:

Input: 889 440 184 820 562 721 618 839 55 141 545 619 137 755 117 815 299 882 172 360 76 538 56 292 625 754 68 282 221 348 642 718 134 665 756 799 302 491 148 836 424 730 220 570 28 363 155 512 120 751 28 157 182 563 549 682 243 837 55 324 64 543 192 205 514 662 174 771 198 534 111 519 114 758 502 701 16 255 155 457 183 392 502 865 110 751 100 726 176 559 58 694 291 316 368 846 24 793 336 673 235 857 719 790 378 413 24 282 191 348 511 773 31 810 485 796 333 860 616 714 139 256 97 474 512 741 351 491 110 752 29 412 66 685 317 543 58 567 68 633 573 748 263 383 478 719 315 770 398 688 294 312 216 773 123 534 43 504 32 351 619 824 14 612 410 657 347 701 101 807 406 679 104 549 284 454 520 687 60 722 670 818 92 291 269 715 723 851 206 241 723 736 212 304 232 706 119 136 289 869 545 645 99 764 131 301 …
Output: YES

Example 3:

Input: 1414 206 1 2 2 3 1 3 801 1210 616 1372 621 924 1005 1162 550 709 1269 1306 666 800 374 898 458 712 648 1203 47 203 850 1183 864 1075 1053 1141 175 992 218 698 473 1245 1000 1164 1263 1296 330 1329 340 530 210 1277 300 1148 426 735 240 909 12 866 11 769 56 1110 561 818 402 1118 338 454 650 946 1131 1346 1048 1268 108 1275 1353 1398 21 1182 304 420 344 395 228 893 242 750 248 484 81 513 212 983 553 859 1237 1363 428 1330 654 862 271 671 659 933 38 683 943 982 329 860 103 1081 456 1049 188 745 768 1194 621 1210 962 1246 23 1240 915 931 120 394 589 673 463 1393 57 1113 54 697 821 1143 889 1369 182 604 253 570 319 976 711 998 521 672 343 1043 176 807 356 1115 350 1177 228 1342 433 1036 653 979 103 845 377 776 36 171 313 371 628 1009 646 1336 1109 1135 705 1326 268 785 395 812 853 1232 833 1335 …
Output: NO

Constraints:

1 <= n <= 2142; 0 <= m <= 4284; self-edges make the answer NO.

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