CT62253

Last corridors of Brewer

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Brewer inherited the dairy at the zephyr cliffs of Galeholm along with its curious bookkeeping system for corridors. 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 <= 1013; 0 <= m <= 2026; self-edges make the answer NO.

Example 1:

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

Example 2:

Input: 670 1609 356 611 16 371 236 334 458 640 223 484 310 379 450 582 365 425 18 280 224 423 139 573 383 491 333 448 205 632 47 349 208 562 606 626 22 583 513 662 190 238 24 319 133 220 47 56 441 573 101 438 307 618 257 381 613 619 19 504 75 497 149 493 26 49 374 418 644 659 29 562 484 646 206 220 111 505 55 94 169 530 110 128 205 654 345 495 313 533 200 357 494 499 73 479 297 615 35 579 128 522 488 638 209 485 85 254 602 631 310 449 68 255 120 250 143 249 313 547 328 515 421 462 324 484 91 296 169 395 274 361 156 201 62 239 341 470 527 551 276 399 332 481 68 178 209 369 81 269 477 536 76 552 202 414 387 567 453 604 452 493 173 664 17 265 492 513 337 361 383 631 124 389 86 547 157 511 358 570 423 567 93 360 29 487 402 664 475 670 19 510 97 393 236 552 290 503 19 48 39 203 414 436 224 638 209 425…
Output: NO

Example 3:

Input: 140 295 89 126 52 76 15 76 8 20 15 62 11 41 75 90 53 90 95 123 109 131 10 34 41 120 19 89 104 138 69 106 52 121 34 84 91 105 22 42 8 35 9 43 46 106 83 113 76 122 8 91 54 119 3 137 38 39 88 123 76 116 57 67 30 55 39 57 82 86 67 131 3 134 18 50 73 121 121 139 14 109 25 79 119 138 79 91 55 114 66 68 40 131 41 110 1 83 103 109 6 121 20 100 68 106 26 90 36 130 39 60 20 124 8 118 24 79 2 90 129 133 19 69 3 48 57 97 8 139 34 96 11 138 75 136 65 108 47 79 32 71 25 113 46 95 42 107 79 133 13 86 72 108 38 74 23 99 108 138 2 100 2 60 21 54 65 122 130 137 75 92 109 140 109 124 39 43 59 68 42 64 23 32 31 88 9 40 20 79 10 55 95 111 19 92 19 128 17 131 5 12 25 109 49 52 35 43 8 123 25 30 42 45 74 79 12 109 54 60 13 57 7 64 52 139 64 68 99 135 9 60 91 100 10 85 15 48 29 77 123 127 11 99 56 138 69 89 21 43…
Output: NO

Constraints:

1 <= n <= 1013; 0 <= m <= 2026; self-edges make the answer NO.

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