CT59901

The bridges at Driftwood

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Every season at the quays of Driftwood, someone must rebuild the damaged itinerary. This year the task falls to Smith, armed only with the bridges register. 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 <= 2069; 0 <= m <= 4138; self-edges make the answer NO.

Example 1:

Input: 781 2751 301 472 440 649 40 218 353 489 52 521 316 447 573 621 416 492 79 238 83 174 25 408 241 614 95 767 53 494 29 429 110 585 186 654 345 543 503 550 438 632 82 194 252 337 71 348 77 628 413 588 62 511 256 636 95 332 238 506 2 453 40 223 99 701 27 432 152 699 628 730 369 756 486 563 232 678 46 146 297 343 171 365 1 634 465 517 279 326 85 104 651 663 224 293 149 272 96 497 13 751 525 630 330 774 695 737 84 634 388 410 279 463 3 357 147 707 14 320 179 668 434 723 43 134 108 277 136 494 610 733 25 145 99 707 76 593 142 243 521 722 246 407 495 754 8 213 63 257 173 433 116 727 299 391 618 736 109 679 300 397 315 530 563 669 24 136 219 675 183 338 162 406 201 735 447 538 438 461 758 777 118 644 554 781 348 704 96 473 104 448 190 438 323 521 574 600 265 670 421 755 223 381 307 455 273 603 468 …
Output: NO

Example 2:

Input: 86 616 3 37 13 29 19 82 25 56 28 74 9 60 43 55 37 59 6 30 72 78 64 65 13 72 8 65 7 75 38 69 14 26 24 37 12 27 4 40 2 4 9 80 17 67 19 39 9 52 28 53 11 15 27 63 31 60 5 14 26 46 19 78 10 33 48 85 12 51 3 43 47 66 50 70 14 68 17 39 10 56 3 79 9 74 29 63 72 75 1 40 61 81 33 66 27 68 11 21 18 40 12 68 21 53 30 75 20 59 12 39 56 61 31 56 15 18 55 83 73 80 77 80 7 77 14 58 9 31 57 58 2 39 14 73 25 48 44 55 15 65 28 81 11 58 46 67 33 61 38 56 5 53 18 41 23 38 20 22 71 77 10 82 24 60 15 40 31 68 40 48 74 78 20 35 29 79 18 71 46 80 58 80 27 82 64 71 65 66 26 83 25 64 14 43 63 81 13 79 27 29 43 84 50 58 20 75 4 19 51 85 5 50 10 48 76 77 65 68 34 45 21 36 15 39 22 59 41 46 33 65 56 75 9 24 12 82 7 78 21 35 10 78 7 20 22 53 2 40 49 61 19 75 9 44 38 63 20 72 33 48 23 42 19 28 54 73 12 14 34 76 33 47 67 …
Output: NO

Example 3:

Input: 702 1257 325 689 101 267 96 270 108 471 224 469 76 160 284 292 294 517 215 388 42 639 474 583 302 525 403 576 461 507 435 567 471 503 316 564 368 523 155 474 161 640 16 204 174 364 235 399 312 530 147 268 115 588 204 494 30 107 133 590 467 564 445 674 363 550 437 585 139 605 362 598 204 578 417 536 44 279 372 578 1 533 185 415 366 539 499 603 241 527 15 174 506 539 129 238 357 569 342 630 58 297 303 476 108 490 603 647 201 342 317 578 286 462 305 700 270 402 591 630 599 640 24 609 115 467 222 475 103 581 98 493 52 434 254 596 198 283 253 341 159 508 176 447 96 262 264 426 252 551 65 388 91 586 98 601 276 583 340 347 213 688 102 466 58 601 228 245 37 303 49 692 36 453 184 432 566 636 541 696 100 446 3 240 105 526 301 369 285 652 21 519 193 564 56 548 61 104 279 413 242 315 546 556 330 496 1…
Output: NO

Constraints:

1 <= n <= 2069; 0 <= m <= 4138; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
The bridges at Driftwood - MEDIUM Coding Problem | CodeTikki