CT57734

Cleo and the Sterling bridges

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Deep in the silver mines of Lodebarrow, Cleo studies rows of bridges entries. One clean number will settle the guild's oldest argument. 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 <= 1773; 0 <= m <= 3546; self-edges make the answer NO.

Example 1:

Input: 752 1274 227 411 384 529 555 624 77 426 72 742 122 339 255 541 219 466 111 472 113 567 508 531 180 257 181 453 406 514 160 222 489 605 344 558 98 731 568 749 705 715 7 745 478 523 93 501 230 361 102 562 153 742 180 435 116 179 387 732 416 698 376 656 9 412 226 389 322 734 33 300 133 450 238 741 344 395 17 235 9 706 202 469 640 701 436 718 421 478 290 694 509 620 249 747 363 745 90 463 70 236 242 537 630 683 554 709 1 622 217 451 357 713 338 400 7 321 312 457 81 114 160 723 487 539 266 529 101 334 221 552 66 200 37 439 149 352 520 603 282 616 382 696 196 431 149 402 419 742 492 748 198 298 102 191 240 588 399 692 112 328 496 639 216 305 238 407 79 526 724 725 345 385 258 664 233 702 105 649 576 622 301 368 289 582 420 521 92 121 187 397 545 562 549 639 119 163 164 525 325 551 293 583 561 67…
Output: NO

Example 2:

Input: 985 1867 1 2 2 3 1 3 312 473 372 946 179 751 707 924 43 436 947 959 2 30 373 913 467 967 207 500 35 264 96 901 98 816 379 579 366 797 225 378 273 398 272 363 516 619 735 856 361 670 367 881 228 546 816 958 358 455 27 165 150 488 66 459 591 718 661 955 496 691 114 553 821 836 407 465 35 368 112 276 733 796 415 790 50 610 144 533 75 636 43 558 728 857 271 885 378 641 417 979 299 435 11 594 271 642 353 586 491 679 582 792 648 799 407 477 209 465 559 560 493 547 10 467 124 805 48 391 511 615 303 381 226 254 798 953 689 763 611 747 245 528 457 519 607 630 527 770 270 631 4 556 115 268 117 937 398 936 212 854 133 513 257 461 244 576 487 536 803 817 53 918 5 249 515 967 360 452 486 771 363 802 815 863 281 857 180 537 240 903 476 672 575 894 644 740 474 830 398 578 250 409 378 820 44 282 60 403 24…
Output: NO

Example 3:

Input: 392 7 1 2 2 3 1 3 87 246 13 371 136 234 13 43
Output: NO

Constraints:

1 <= n <= 1773; 0 <= m <= 3546; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
Cleo and the Sterling bridges - MEDIUM Coding Problem | CodeTikki