CT61427

Tomas and the Windward bridges

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Every season at the clockwork quarter of Gearford, someone must prove the quality of the harvest. This year the task falls to Tomas, armed only with the bridges register. 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 <= 2413; 0 <= m <= 4826; self-edges make the answer NO.

Example 1:

Input: 659 4246 49 520 147 576 133 606 236 442 488 600 148 197 231 615 146 435 128 561 67 71 29 624 280 631 115 557 297 548 39 162 132 299 221 589 591 606 95 450 328 371 57 165 185 580 33 293 388 654 146 512 20 312 247 295 101 134 366 536 276 596 158 604 269 398 209 578 349 457 85 486 238 461 239 541 22 644 422 575 15 313 304 365 294 436 26 526 282 433 303 413 363 583 291 440 21 339 61 653 12 136 454 595 535 654 421 459 325 505 154 261 81 590 90 167 70 168 7 202 246 398 254 597 31 510 221 511 440 452 187 382 336 409 494 650 35 536 298 608 48 85 1 197 165 638 364 552 13 333 502 540 10 536 166 542 487 494 191 521 113 243 248 620 131 482 309 552 80 555 195 261 534 644 6 422 416 613 349 536 594 641 188 374 11 221 20 151 409 428 63 115 407 606 166 454 232 308 137 215 282 427 310 372 87 369 311 478 206…
Output: NO

Example 2:

Input: 913 4241 212 434 10 181 683 840 66 722 564 650 172 237 36 671 549 806 312 574 461 552 796 893 38 402 67 282 788 867 649 895 409 716 328 798 337 826 173 797 494 726 196 637 507 802 412 427 235 501 237 792 49 405 756 810 32 813 432 570 693 867 41 303 102 492 276 515 267 804 152 604 364 544 18 161 591 614 340 482 124 862 157 584 318 910 190 538 528 881 30 753 664 815 569 870 505 527 161 538 579 598 442 617 93 337 784 880 830 841 696 723 74 314 56 888 20 577 148 722 479 879 44 895 333 337 678 879 115 428 94 455 55 626 611 814 136 436 52 506 557 812 131 856 111 315 282 679 344 520 105 422 766 796 600 681 672 731 154 168 351 376 513 810 161 665 101 285 205 743 457 894 277 366 166 201 600 886 493 588 581 792 271 874 120 201 72 658 247 876 340 813 205 342 202 602 141 220 347 836 37 837 533 609 653…
Output: NO

Example 3:

Input: 256 3456 66 193 87 217 10 148 137 232 43 134 32 251 113 222 5 171 29 83 153 217 28 84 79 162 107 230 4 186 49 249 81 112 136 147 160 207 83 223 104 198 70 255 132 160 105 113 20 97 74 250 82 153 114 122 35 60 208 221 191 198 28 246 171 248 141 195 67 81 20 118 72 161 31 206 56 118 15 39 55 180 16 138 137 182 110 253 67 186 191 223 23 51 114 210 44 167 15 251 148 252 109 222 130 148 182 238 2 85 108 202 54 140 187 248 12 183 87 239 37 253 70 185 186 190 5 160 108 190 36 225 40 230 147 173 75 228 3 165 44 127 32 189 39 237 10 210 27 235 21 30 47 136 207 224 53 85 130 152 112 149 142 247 43 44 116 235 2 32 80 246 86 211 94 149 55 196 121 189 112 208 4 28 58 162 54 64 22 47 157 217 124 178 151 169 25 104 90 145 138 195 115 213 210 233 30 89 167 207 50 236 74 132 9 243 136 222 32 34 167 174 140…
Output: NO

Constraints:

1 <= n <= 2413; 0 <= m <= 4826; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
Tomas and the Windward bridges - MEDIUM Coding Problem | CodeTikki