CT64915

The Bloomglass Two Guilds

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

The paymaster Bram has been asked to verify the safety inspections. On the desk lies a long table of bridges 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 <= 1444; 0 <= m <= 2888; self-edges make the answer NO.

Example 1:

Input: 652 174 179 463 531 577 282 474 613 618 244 590 31 86 31 96 132 211 94 378 178 384 142 313 255 473 293 528 12 247 78 200 143 212 554 561 391 426 106 592 176 246 87 206 18 218 376 627 267 621 272 589 232 334 83 352 191 268 45 400 247 429 26 251 155 275 11 632 296 635 177 618 143 462 171 206 423 471 96 435 236 566 18 594 249 422 81 443 184 303 476 551 539 607 251 598 366 491 383 548 152 359 480 627 260 307 116 591 393 452 86 540 209 528 256 542 87 531 44 607 151 276 186 389 119 437 134 161 143 293 125 497 339 524 218 577 448 543 282 598 123 147 573 579 50 398 82 198 88 349 94 325 11 230 317 478 43 70 391 473 181 462 13 132 46 216 349 644 580 614 10 206 155 382 20 265 215 616 103 174 54 241 6 642 187 205 330 461 14 596 79 563 76 549 16 143 253 324 296 604 41 290 56 518 249 377 239 542 55 565 …
Output: YES

Example 2:

Input: 1278 2151 428 881 363 584 548 884 47 726 557 1154 31 355 275 591 492 959 802 980 709 1127 846 1053 77 246 408 796 594 1185 824 1081 355 687 864 1228 184 492 872 1046 799 803 263 523 1127 1210 763 996 106 942 334 1038 249 987 271 853 11 1085 113 1028 884 1227 264 291 46 82 479 584 457 821 503 703 323 1225 18 1138 631 1264 1080 1233 91 1088 677 779 447 646 683 1254 93 1172 407 756 80 339 96 650 660 728 92 853 403 736 287 522 557 1033 357 1021 90 1166 480 1137 716 841 553 1221 1192 1258 380 932 458 604 209 498 348 797 245 1274 276 805 26 849 378 999 317 911 305 417 726 1131 441 1245 128 468 39 68 282 436 111 314 1079 1186 450 580 361 737 789 993 27 757 397 661 1148 1264 522 1234 205 655 486 830 165 672 106 588 79 838 228 722 76 616 240 519 1163 1254 478 1154 670 794 323 885 52 701 69 880 500 …
Output: NO

Example 3:

Input: 1274 2230 1 2 2 3 1 3 186 620 254 483 219 552 1028 1069 131 1083 28 742 609 1179 676 681 506 760 136 524 249 941 13 439 215 1022 623 955 800 1209 383 453 65 239 275 1202 133 311 419 982 579 878 593 1007 541 1116 847 1069 3 460 61 272 407 1125 873 1076 479 547 436 618 710 832 195 937 656 1183 469 531 436 473 452 650 53 1074 153 575 225 465 70 1231 332 1145 17 63 620 1076 44 564 106 650 512 776 484 859 493 1140 430 469 764 1157 641 1217 5 845 452 1014 853 1216 146 999 317 940 582 639 46 612 503 775 180 943 179 622 182 312 995 1250 778 1181 179 999 400 1274 595 1263 535 983 695 850 10 716 14 159 79 545 89 188 314 628 1043 1122 763 918 199 305 776 872 505 549 1031 1215 118 407 138 703 766 899 239 1071 43 325 488 653 621 843 1030 1260 712 1093 718 1054 783 1166 489 1140 646 1259 622 850 6 1010 …
Output: NO

Constraints:

1 <= n <= 1444; 0 <= m <= 2888; self-edges make the answer NO.

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