CT57300

The Glowfen Two Guilds

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Draper the quartermaster watches over the lantern district of Glowfen's stores of canals. A careful computation stands between order and chaos. 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 <= 818; 0 <= m <= 1636; self-edges make the answer NO.

Example 1:

Input: 14 71 8 10 7 13 7 11 1 2 6 9 1 12 6 13 1 9 1 4 2 12 2 14 10 13 11 13 8 9 10 14 3 13 1 7 3 9 9 11 1 10 7 14 6 14 3 8 8 13 4 14 7 12 11 12 4 8 4 11 5 14 9 14 1 6 8 14 9 13 4 6 2 9 5 7 3 6 5 8 2 6 3 4 2 4 12 13 5 6 4 5 10 12 1 13 6 8 6 10 7 10 1 8 1 5 4 7 4 12 2 10 1 11 12 14 7 8 13 14 3 11 4 13 4 10 3 7 9 10 3 12 2 8 8 11 2 7 2 13 6 12 6 7
Output: NO

Example 2:

Input: 796 872 56 567 400 722 290 347 193 762 155 647 48 306 622 630 72 323 532 683 269 672 294 427 163 679 69 94 142 226 99 386 116 653 462 618 5 169 114 364 506 772 700 774 59 773 216 534 174 442 256 693 244 600 367 670 18 45 350 369 593 737 169 212 33 63 534 711 335 599 28 712 231 618 323 327 291 665 205 432 195 480 90 735 522 687 474 611 702 753 40 242 20 223 37 695 318 610 69 148 597 773 583 690 13 431 577 748 71 282 31 110 119 131 469 733 227 608 255 291 292 761 93 550 204 745 173 626 344 369 385 427 257 466 109 259 167 339 623 690 293 547 89 283 596 705 651 759 166 199 172 305 526 687 475 485 96 306 293 342 362 457 30 594 343 592 602 668 580 699 688 745 8 294 403 608 271 651 245 253 97 364 519 790 385 686 121 539 317 515 163 776 76 295 566 579 58 343 300 631 229 545 106 502 3 69 532 760 39…
Output: NO

Example 3:

Input: 25 154 4 15 1 10 1 13 18 20 3 18 2 19 7 18 19 23 8 23 1 25 6 10 10 21 5 24 2 21 2 17 12 17 16 25 1 11 12 24 3 23 1 22 8 11 11 24 10 13 15 24 1 4 5 9 11 22 7 12 2 13 11 15 19 21 10 16 3 5 5 12 5 14 12 25 7 14 22 23 5 13 12 16 9 19 4 9 13 23 1 5 15 16 5 7 16 23 14 22 3 8 1 7 1 3 8 22 1 24 8 25 8 21 3 7 20 25 2 25 9 18 17 25 11 12 1 19 4 24 19 24 11 13 15 23 23 25 11 16 5 17 15 25 5 18 9 23 4 11 3 11 17 24 11 23 16 17 13 17 5 15 12 22 14 16 14 25 19 20 16 18 5 23 20 22 3 13 6 17 6 8 2 10 1 8 10 19 5 10 21 23 3 10 8 15 10 17 2 23 10 11 3 17 2 11 4 25 2 20 18 25 6 20 1 21 12 23 12 19 9 13 7 8 8 12 12 20 21 24 2 15 4 23 17 19 17 23 1 20 13 20 2 7 10 25 12 21 18 22 11 20 14 15 1 12 14 17 3 25 18 21 7 25 6 15 1 14 10 14 4 16 13 19 13 21 2 12 9 24 19 25 2 18 7 9 10 15 17 22 8 10 7 20 10 23 14 18 3 …
Output: NO

Constraints:

1 <= n <= 818; 0 <= m <= 1636; self-edges make the answer NO.

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