CT64701

Captain's Ledger of tunnels

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Captain inherited the kitchen at the gull cliffs of Screech Point along with its curious bookkeeping system for tunnels. Time to make sense of it. 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 <= 1184; 0 <= m <= 2368; self-edges make the answer NO.

Example 1:

Input: 207 1670 149 196 3 89 127 141 40 75 129 150 92 172 35 113 57 67 43 53 17 138 63 173 3 181 94 173 71 147 123 126 2 128 60 201 128 181 97 157 29 82 105 192 175 180 11 92 162 190 15 168 182 192 71 102 26 186 57 115 45 105 195 203 12 46 79 183 42 111 145 182 87 142 18 106 32 164 23 98 1 82 169 170 110 195 88 188 149 189 41 105 31 176 80 197 34 84 52 110 16 199 86 185 144 148 62 150 65 101 107 122 167 200 35 192 160 166 25 108 16 142 31 131 53 166 97 135 58 116 47 102 49 108 152 185 141 154 11 201 111 128 104 132 140 200 34 107 98 115 191 194 101 199 31 152 32 175 72 160 8 24 136 143 140 176 131 201 142 173 27 104 50 54 148 177 197 207 45 145 12 122 61 179 38 50 29 156 68 144 193 196 81 201 68 120 96 141 10 169 66 154 41 165 152 192 70 179 24 145 146 156 167 185 136 152 51 96 129 204 93 146 37 …
Output: NO

Example 2:

Input: 946 1612 99 891 5 167 73 224 56 758 133 386 43 514 734 872 707 886 816 840 54 426 191 714 475 791 126 696 241 445 518 899 550 689 61 844 79 382 118 334 144 302 308 436 5 547 182 808 436 946 139 603 546 724 80 403 4 676 184 805 47 836 399 518 93 513 383 405 157 926 325 591 321 659 43 362 46 525 49 498 737 874 227 595 11 447 931 937 192 877 461 800 297 668 686 769 76 917 294 778 179 611 301 848 46 397 107 601 811 850 51 362 627 675 95 198 201 749 34 176 193 503 44 582 167 214 141 304 131 774 532 679 454 704 290 927 100 512 412 943 139 920 111 516 906 920 6 331 426 552 785 928 261 565 305 322 645 674 156 510 86 529 86 346 72 289 526 890 22 870 23 696 263 837 110 397 280 713 396 687 50 674 742 815 187 668 68 515 64 515 694 892 566 650 175 256 396 470 53 68 45 579 647 886 197 831 295 819 449 49…
Output: NO

Example 3:

Input: 1022 1898 188 930 510 583 651 809 543 971 374 985 330 709 699 738 126 846 464 882 117 220 428 617 497 696 66 157 635 784 242 314 436 775 440 750 352 354 666 956 369 898 64 377 493 727 625 861 52 525 188 495 328 910 135 344 223 473 365 1006 731 850 73 872 282 981 194 625 191 401 433 610 274 779 243 682 577 703 73 909 456 939 582 973 181 809 17 373 517 582 18 963 37 349 146 974 430 492 233 613 373 560 614 715 737 773 264 1002 435 760 375 381 823 881 409 849 87 498 606 689 257 309 61 382 27 778 10 190 639 657 485 736 338 847 697 706 137 438 96 485 321 712 443 1000 519 901 169 485 725 767 221 270 152 565 563 666 64 759 175 258 580 709 303 747 146 690 547 712 108 591 155 325 536 577 436 744 603 907 203 913 222 234 265 673 146 383 473 642 922 995 448 1021 209 404 218 658 34 793 97 218 298 591 39…
Output: NO

Constraints:

1 <= n <= 1184; 0 <= m <= 2368; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
Captain's Ledger of tunnels - MEDIUM Coding Problem | CodeTikki