CT58846

Hope's Quiet Ledger

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Hope found an old ledger of routes in the loom house attic at the coastal hub of Tidewater. The margin notes pose a precise question. 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 <= 2162; 0 <= m <= 4324; self-edges make the answer NO.

Example 1:

Input: 834 3869 1 2 2 3 1 3 583 726 545 785 91 239 228 613 258 762 256 521 34 208 376 491 394 462 433 526 270 547 152 212 344 651 70 771 9 75 209 724 229 633 559 738 46 573 150 342 227 573 250 711 49 755 235 510 147 651 140 755 354 403 553 567 117 699 218 305 439 762 257 462 460 753 182 417 198 503 604 739 564 762 277 585 418 663 156 655 19 188 123 392 236 471 617 711 39 459 159 590 39 93 187 651 292 509 209 670 213 462 120 530 508 799 526 588 295 817 32 37 107 533 669 709 251 639 463 469 135 775 5 439 149 680 530 655 453 702 518 591 537 749 286 684 151 308 292 787 117 185 612 660 107 658 117 551 485 726 42 547 22 509 444 794 568 624 120 252 4 94 681 700 252 830 169 580 278 575 508 741 294 805 235 389 750 764 346 408 245 545 636 705 459 781 339 766 51 191 232 589 21 573 89 375 536 574 238 777 28 …
Output: NO

Example 2:

Input: 938 103 84 704 247 791 180 813 129 760 596 733 345 562 131 893 213 927 198 408 384 398 615 801 683 767 588 844 565 663 302 608 20 175 95 419 114 698 209 864 287 906 154 265 174 568 11 758 663 938 683 771 292 914 398 491 533 845 248 727 9 770 342 547 136 230 86 894 54 239 334 768 480 803 330 413 154 666 451 521 596 736 353 730 334 878 426 848 785 895 46 772 57 292 686 881 408 678 307 490 4 458 65 118 468 799 155 861 369 528 117 837 255 342 396 930 22 477 386 715 200 893 647 890 477 655 56 247 130 565 295 461 217 764 466 570 441 891 601 828 191 800 18 863 184 360 668 794 750 845 109 136 433 714 703 805 244 633 622 718 529 615 100 781 690 814 309 559 67 909 224 361 464 828 146 467 393 907 614 751 708 866 44 62 182 535 138 207 46 448 814 890 253 586 683 905 795 813 16 713 513 660 600 630 556 8…
Output: YES

Example 3:

Input: 1556 1752 374 977 235 897 841 1302 407 1506 1308 1419 302 544 427 441 635 720 148 977 1217 1277 978 1277 352 724 524 1337 781 1388 222 478 135 1175 453 1379 482 1055 682 982 286 502 12 959 434 1260 181 1063 729 1353 155 576 1082 1469 396 1549 450 600 13 547 469 579 34 1165 138 283 681 1118 25 1487 218 372 631 1525 1039 1297 848 1354 242 1512 419 1354 81 939 786 1186 601 627 588 1261 121 519 284 897 759 1447 1098 1372 56 1276 548 762 804 1497 790 1127 55 412 651 1056 288 1553 328 1131 7 220 915 1414 326 511 970 1352 33 1363 397 1261 596 1101 903 1207 694 1282 443 1368 565 609 392 1019 301 632 242 364 150 158 73 1320 154 1456 1065 1244 940 1018 474 1555 321 1483 122 1029 160 1346 462 929 460 730 523 927 253 468 181 1481 164 1491 130 950 41 1106 589 804 150 1251 685 772 295 1128 1269 1505 132…
Output: NO

Constraints:

1 <= n <= 2162; 0 <= m <= 4324; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.