CT51240

The Dusky corridors of Tina

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Legend says the vault under the boar woods of Tuskmore opens only for a perfect tally of corridors. Tina means to find out. 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 <= 1542; 0 <= m <= 3084; self-edges make the answer NO.

Example 1:

Input: 50 884 46 48 5 25 25 49 23 32 13 28 9 22 43 45 12 16 8 49 14 19 22 31 19 48 8 23 1 31 3 10 25 45 22 49 12 43 18 34 1 10 42 44 18 42 24 47 37 47 15 19 11 32 7 45 17 50 24 28 1 29 4 50 13 35 8 28 28 32 5 28 41 50 6 10 18 25 2 31 14 39 16 31 31 34 16 24 19 29 11 44 20 32 13 23 13 46 6 26 29 30 14 35 43 48 30 42 9 49 4 32 23 33 36 45 1 46 15 35 29 37 11 23 9 41 22 33 17 40 9 32 8 44 18 23 9 48 13 33 24 26 15 22 6 23 2 16 21 23 19 26 5 19 16 30 31 48 5 32 7 19 23 41 35 49 17 28 35 41 2 21 21 31 33 37 17 29 6 33 22 46 20 39 40 45 15 32 12 15 1 38 19 30 25 33 20 30 15 45 4 25 42 49 8 16 26 46 3 36 11 29 17 31 7 49 11 16 1 50 25 44 12 34 7 41 27 35 32 38 31 43 8 25 24 32 45 50 6 50 3 40 28 31 14 30 40 49 5 38 9 25 8 30 35 46 22 37 4 33 6 13 21 42 24 39 18 39 5 7 39 48 3 22 40 44 16 18 12 37 36 43 …
Output: NO

Example 2:

Input: 954 1025 180 378 143 371 6 221 136 654 534 796 684 769 502 756 242 541 371 903 830 917 776 838 501 648 90 483 281 792 99 814 102 645 60 574 41 377 93 748 331 358 571 952 287 413 91 942 65 409 299 928 737 783 322 852 651 715 348 546 143 382 439 872 66 215 176 595 240 725 52 295 4 475 236 299 646 862 523 855 50 344 550 803 201 746 452 592 77 706 173 260 214 251 343 596 106 883 239 476 9 576 73 467 910 927 504 926 41 621 603 766 298 875 804 871 243 911 141 604 460 757 37 560 422 825 393 778 291 679 676 868 177 845 312 477 673 680 565 718 251 836 644 925 25 156 695 915 90 200 354 708 348 796 196 647 496 607 391 808 94 898 671 896 3 776 263 909 42 115 141 606 505 799 213 776 390 636 649 760 468 785 360 540 131 827 485 904 99 630 704 930 28 592 423 704 219 742 740 830 58 87 367 424 132 444 147 7…
Output: NO

Example 3:

Input: 593 2055 220 455 368 490 424 501 15 456 335 437 80 592 470 485 117 128 303 537 128 161 281 337 113 236 428 471 325 463 428 516 289 396 541 565 429 573 172 173 427 468 150 444 365 548 153 428 417 524 24 63 244 330 377 481 126 377 261 523 190 405 353 507 145 340 48 298 170 374 383 546 276 288 105 378 105 523 167 278 54 547 84 518 376 493 126 210 253 265 131 336 135 562 12 366 166 544 52 371 94 403 334 425 411 469 33 574 148 154 70 92 92 310 423 434 45 170 256 513 242 292 104 568 128 211 254 462 24 214 332 551 137 592 251 331 184 508 217 576 154 221 102 561 142 419 401 587 366 565 234 453 362 394 544 575 455 555 379 520 221 581 246 434 135 399 11 185 256 487 366 480 312 335 17 194 283 590 228 586 183 239 90 383 193 285 108 206 279 396 118 241 289 379 460 523 110 523 555 556 9 21 6 332 295 399…
Output: NO

Constraints:

1 <= n <= 1542; 0 <= m <= 3084; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
The Dusky corridors of Tina - MEDIUM Coding Problem | CodeTikki