CT62397

Pale corridors Two Guilds

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

The log keeper Seth 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 <= 1648; 0 <= m <= 3296; self-edges make the answer NO.

Example 1:

Input: 693 1343 1 2 2 3 1 3 464 467 152 557 230 498 51 456 213 576 58 120 536 568 145 483 351 630 134 299 235 410 100 641 122 212 35 184 346 503 103 285 303 589 29 441 97 634 616 637 374 594 542 674 34 110 220 681 199 666 81 232 269 492 210 654 65 358 105 449 202 230 103 619 224 673 69 148 116 677 72 390 29 106 20 235 58 264 263 484 23 477 165 454 216 485 242 465 511 581 312 663 133 424 67 275 223 465 17 687 189 481 71 641 427 525 261 496 388 535 131 359 53 396 392 638 116 468 201 576 508 684 122 639 430 525 118 145 206 626 93 339 14 377 132 414 460 590 282 326 232 545 230 630 171 184 299 630 59 302 208 462 315 412 253 366 31 684 408 655 190 269 122 637 57 491 179 412 114 535 93 434 522 523 54 228 191 685 378 670 404 575 171 299 142 366 312 590 121 350 27 368 392 419 236 285 452 502 174 447 4 661…
Output: NO

Example 2:

Input: 1142 1162 1 2 2 3 1 3 156 637 604 871 497 651 8 702 714 722 238 406 374 916 749 964 103 374 1049 1098 678 1002 749 793 41 53 127 331 15 345 529 944 33 505 374 426 210 265 199 1121 735 760 78 887 620 783 308 696 511 886 582 1020 44 832 237 451 223 736 877 1025 449 1109 516 819 370 387 108 651 194 849 20 757 301 854 86 424 878 962 45 582 296 404 11 615 278 625 443 938 337 397 291 610 950 1003 904 917 341 805 506 853 637 663 766 927 106 597 72 206 124 1051 651 836 541 834 79 805 234 255 156 1079 397 796 541 642 806 1082 499 818 625 872 315 851 196 635 471 1116 344 662 307 975 548 955 199 447 231 862 336 1007 914 1116 52 569 128 1109 678 1099 20 194 77 263 603 757 417 618 38 1099 107 612 233 279 812 961 121 545 12 928 216 360 842 931 121 443 338 1101 33 988 362 770 369 727 157 726 536 954 175 …
Output: NO

Example 3:

Input: 1383 2332 895 1238 230 805 1309 1335 225 1035 791 965 419 1162 109 163 643 1339 789 808 1202 1246 471 1143 766 1014 185 672 724 1215 1017 1204 312 495 853 1171 475 978 941 1336 298 446 942 973 650 721 185 551 242 250 223 939 6 945 163 870 169 767 81 1206 822 1224 207 988 230 1337 708 1106 220 460 122 129 727 963 193 285 1039 1113 58 841 410 846 433 901 457 1380 137 1193 170 1086 761 1155 109 1363 789 947 3 236 92 485 91 223 200 1233 110 838 518 692 564 1228 233 1274 53 181 72 841 534 712 480 954 19 1185 242 435 807 932 410 539 232 1279 629 735 252 1102 434 1089 702 788 195 1267 55 860 278 1341 508 839 488 1255 19 113 535 594 214 579 977 1345 267 783 1098 1131 566 1155 137 1218 938 1162 214 930 636 835 78 1214 1182 1251 1086 1365 53 1068 129 1002 714 742 614 1199 98 784 129 856 277 888 783 …
Output: NO

Constraints:

1 <= n <= 1648; 0 <= m <= 3296; self-edges make the answer NO.

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