CT64932

The Two Guilds of Pearldeep

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

In the coral atoll of Pearldeep, Maya the surveyor keeps careful count of the roads. Price the new merchandise line, every figure matters. 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 <= 1230; 0 <= m <= 2460; self-edges make the answer NO.

Example 1:

Input: 1007 2362 535 809 13 815 330 601 425 505 310 498 372 446 793 883 74 857 469 583 275 731 326 599 823 851 102 651 463 708 34 948 128 848 235 490 627 682 191 260 766 980 290 711 746 904 546 570 46 701 173 479 191 313 135 899 64 945 501 505 197 595 944 1001 271 670 145 975 245 672 504 559 664 673 545 616 246 295 16 765 42 280 37 593 303 720 169 699 46 480 90 873 12 213 851 909 158 772 11 400 7 116 493 576 416 633 121 472 55 378 566 946 1 51 378 537 150 205 21 985 552 657 611 922 35 807 220 970 523 944 270 403 111 362 379 946 277 501 453 946 394 501 549 570 540 654 796 868 418 877 68 613 101 200 210 548 243 975 269 999 124 847 314 410 532 637 680 768 110 890 372 910 543 762 4 489 214 370 594 971 292 531 182 372 114 1004 704 834 108 975 904 967 655 805 50 165 95 451 487 497 277 577 85 337 237 41…
Output: NO

Example 2:

Input: 487 2235 1 2 2 3 1 3 165 324 27 467 9 402 424 433 146 164 225 378 82 179 29 325 144 313 29 93 197 343 256 308 88 268 58 448 170 196 110 476 3 82 20 41 117 404 377 470 245 370 272 347 213 227 68 184 278 409 149 455 179 205 92 273 99 285 5 120 264 394 20 477 161 166 221 365 163 209 324 403 229 363 276 417 280 399 84 385 2 362 60 90 224 329 99 291 173 387 56 280 181 334 99 294 151 353 136 288 147 405 58 230 34 103 306 413 1 41 12 104 125 168 189 192 82 408 367 378 115 307 51 268 219 224 113 333 83 206 265 470 29 95 57 153 301 391 76 394 107 265 194 487 52 191 286 363 273 336 256 407 22 170 45 231 413 476 77 113 156 454 129 194 197 238 366 470 109 467 202 374 139 435 323 418 71 305 267 377 224 228 65 118 264 323 218 294 423 466 140 246 269 287 118 148 184 202 346 451 170 218 20 272 158 194 52 …
Output: NO

Example 3:

Input: 1153 141 562 815 655 1084 424 909 271 276 566 901 72 508 514 592 633 871 440 1102 157 714 930 1036 190 973 935 1000 1063 1146 363 991 803 998 448 641 408 910 384 1090 126 455 486 828 883 903 902 948 344 771 588 749 151 1142 98 323 92 777 649 778 66 604 418 691 86 355 836 906 1005 1021 424 920 103 511 921 1032 383 830 409 533 528 736 336 1092 1056 1100 452 556 57 393 409 542 481 556 655 708 880 983 742 896 466 1151 576 849 369 769 467 652 15 200 511 684 486 726 285 704 298 889 139 1092 422 591 480 729 645 864 536 941 212 944 107 962 184 971 71 1092 603 758 306 810 421 628 683 819 279 760 344 989 493 821 100 1067 69 939 38 1108 900 1000 304 1052 768 963 449 818 65 332 52 950 671 829 276 742 297 454 281 558 289 702 252 1051 434 712 210 367 268 960 231 552 679 841 72 402 635 708 59 140 372 768…
Output: YES

Constraints:

1 <= n <= 1230; 0 <= m <= 2460; self-edges make the answer NO.

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