CT57830

The Two Guilds at Alabast

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Morning light hits the ivory gates of Alabast as Admiral unrolls the day's manifest of bridges. The tally will decide the next shipment. 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 <= 2561; 0 <= m <= 5122; self-edges make the answer NO.

Example 1:

Input: 575 673 1 2 2 3 1 3 217 487 220 341 422 555 462 564 203 471 459 514 158 269 32 300 131 481 428 567 208 295 417 570 281 462 27 49 90 209 9 442 330 372 75 552 148 263 444 536 136 559 165 289 381 567 377 379 456 526 386 453 19 522 198 295 293 317 111 475 64 474 247 402 141 243 274 350 81 359 17 512 301 341 251 264 429 474 131 243 358 454 318 575 111 476 59 72 114 377 490 498 60 367 151 196 63 168 94 162 150 501 94 483 333 572 309 366 106 414 111 141 179 492 328 533 232 317 112 281 166 408 131 271 67 537 116 389 137 224 349 382 306 351 198 396 175 261 72 411 260 413 202 205 330 508 273 379 216 519 29 32 367 451 46 259 184 351 135 420 138 328 55 513 2 429 387 490 23 553 126 527 67 153 278 517 516 547 273 334 43 133 226 506 187 379 229 462 61 191 152 491 316 368 165 506 281 476 159 292 439 565 2…
Output: NO

Example 2:

Input: 69 1474 10 54 5 49 44 53 3 12 19 44 23 53 33 46 32 54 7 59 8 66 17 51 14 25 38 45 11 49 30 63 2 16 7 18 7 31 22 28 24 33 26 58 1 30 29 69 31 47 11 34 14 34 4 52 4 55 11 16 20 49 25 63 44 46 61 63 2 12 20 30 45 51 23 34 31 65 18 28 5 53 7 41 20 33 56 67 39 62 5 23 20 39 1 56 5 14 45 57 25 26 3 18 13 26 11 26 7 33 30 32 14 26 52 64 10 12 12 67 7 69 4 43 25 33 24 58 15 55 5 20 18 62 35 57 9 33 38 59 60 63 8 62 27 61 9 28 22 25 20 40 7 38 14 59 9 62 7 67 10 66 27 39 6 15 16 39 37 60 33 37 30 48 56 69 42 50 56 62 10 27 20 69 2 11 27 60 4 49 13 68 5 64 16 20 2 31 12 28 6 9 18 58 24 39 47 61 4 12 14 47 5 52 45 67 4 67 33 68 26 47 27 66 3 66 20 58 15 56 9 16 41 62 7 66 12 30 6 52 31 42 3 32 20 23 8 40 15 33 37 52 42 56 6 67 14 16 29 55 1 59 22 44 5 59 53 60 2 52 16 25 27 50 36 38 50 65 42 51 7 15 …
Output: NO

Example 3:

Input: 780 4689 563 676 338 479 56 374 14 24 4 243 47 460 574 659 269 517 271 607 21 322 179 530 55 77 4 420 397 611 132 516 154 240 379 562 480 624 410 544 238 420 197 218 337 774 306 434 165 552 222 662 398 401 40 326 4 417 700 742 206 646 115 119 159 715 618 655 158 392 146 724 19 388 280 504 187 209 61 373 24 99 468 691 107 455 368 529 246 513 403 603 75 726 478 659 83 759 72 97 151 654 40 529 389 524 67 512 272 653 143 549 117 532 313 615 701 779 231 363 25 185 143 711 522 779 147 618 311 586 267 570 431 510 608 736 408 588 35 145 53 695 91 531 157 742 204 716 143 435 434 447 20 529 483 600 50 98 289 637 195 238 112 655 3 139 18 584 572 740 248 533 373 706 216 483 264 330 122 616 511 567 82 746 307 423 344 601 216 410 109 759 161 381 1 689 166 688 68 284 265 330 508 648 1 404 80 695 325 734 …
Output: NO

Constraints:

1 <= n <= 2561; 0 <= m <= 5122; self-edges make the answer NO.

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