CT60684

Last roads of Axel

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Before the gates of the orchard lands of Applerun close for winter, Axel must finish the roads ledger - one figure at a time. 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 <= 1205; 0 <= m <= 2410; self-edges make the answer NO.

Example 1:

Input: 974 876 1 2 2 3 1 3 404 479 442 739 29 916 358 829 336 459 130 832 109 373 469 601 310 595 385 533 23 180 19 279 556 800 728 907 312 790 59 857 87 248 7 536 36 60 342 658 290 472 522 873 112 495 157 412 69 804 611 785 696 717 637 764 312 899 123 925 445 885 23 559 198 645 157 478 26 580 513 920 383 537 686 953 29 205 166 352 256 722 401 660 373 698 600 757 6 600 182 698 772 895 809 817 618 806 157 166 420 734 522 628 352 666 158 455 280 973 271 889 154 487 170 924 147 388 294 579 208 467 279 469 496 563 502 818 213 600 104 193 55 370 694 923 833 941 366 706 60 686 123 307 431 460 473 894 246 697 108 764 513 554 25 210 172 694 577 764 276 869 24 434 139 432 638 774 254 257 135 152 166 687 183 780 451 556 117 802 704 713 295 401 37 709 225 319 540 582 11 458 616 931 54 141 405 866 678 973 15…
Output: NO

Example 2:

Input: 134 2373 1 2 2 3 1 3 16 60 119 126 97 109 65 91 22 30 6 53 37 120 4 18 29 74 26 28 76 134 18 91 67 127 49 93 30 40 81 131 48 84 40 87 109 112 1 36 43 134 54 96 53 98 41 103 18 125 59 73 38 83 84 102 105 108 91 119 11 27 81 122 37 51 37 69 51 102 36 62 39 116 47 99 2 73 39 94 40 86 44 51 65 93 20 86 9 126 23 63 68 81 12 49 47 126 41 91 88 122 8 110 11 105 10 24 36 105 85 102 55 91 46 48 45 93 34 120 15 77 71 100 52 107 54 105 2 22 71 120 18 108 15 107 84 107 67 91 77 85 80 82 21 79 23 37 65 134 76 133 4 83 41 51 130 131 2 59 101 119 81 94 15 24 27 89 28 47 30 83 77 131 29 123 63 83 49 78 34 100 29 60 64 70 36 97 30 122 9 72 38 97 54 127 25 74 123 124 103 120 41 64 61 96 47 64 18 22 2 80 89 106 25 55 57 102 22 91 4 129 1 108 48 119 15 36 37 57 75 109 57 81 6 42 53 55 21 39 81 90 46 131 93 11…
Output: NO

Example 3:

Input: 792 1432 347 676 325 775 203 411 19 653 131 175 638 707 433 574 361 573 253 336 78 384 601 640 366 705 18 661 21 435 194 704 311 628 472 643 528 610 229 682 717 753 144 407 97 718 212 718 394 613 166 456 362 483 346 588 77 235 315 760 13 432 643 750 6 265 292 576 159 415 581 711 554 721 532 661 257 569 160 783 276 288 4 463 209 331 191 771 132 324 425 597 266 495 171 175 215 362 357 676 37 359 62 461 61 118 460 773 177 784 242 509 497 672 185 551 386 475 531 577 325 597 325 711 464 570 376 393 211 474 370 647 117 342 515 742 229 600 681 686 82 725 357 606 285 788 188 641 90 273 509 619 61 398 226 539 66 190 202 790 265 718 316 683 105 596 257 370 393 722 556 747 345 524 55 216 57 582 160 323 360 439 180 274 67 336 141 528 199 587 122 761 67 420 120 263 27 94 118 391 72 191 10 693 695 710 1…
Output: NO

Constraints:

1 <= n <= 1205; 0 <= m <= 2410; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
Last roads of Axel - MEDIUM Coding Problem | CodeTikki