CT63286

The Moonlit bridges of Jessa

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Before the gates of the railway depot of Cinderline close for winter, Jessa must finish the bridges ledger - one figure at a time. 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 <= 2625; 0 <= m <= 5250; self-edges make the answer NO.

Example 1:

Input: 129 25 4 53 35 51 54 126 6 92 20 115 42 101 6 110 98 108 22 114 22 107 42 47 4 94 60 89 54 68 9 10 14 91 21 44 8 14 19 69 53 107 68 129 18 27 3 125 36 61 87 102
Output: YES

Example 2:

Input: 1877 1201 704 847 391 1038 118 956 323 1407 409 841 675 1784 523 1102 258 854 1089 1147 847 1734 494 1299 673 918 294 577 630 1387 1005 1794 255 1112 1022 1353 1098 1617 669 1354 99 1186 197 353 1032 1824 290 835 1386 1873 405 1656 471 1234 536 879 532 1659 116 946 307 1382 18 1766 449 928 408 1397 1055 1070 903 1875 753 1013 156 458 787 1739 686 1576 1306 1451 279 891 472 1010 1304 1676 408 1228 68 999 386 437 1225 1604 975 1601 77 492 234 1290 196 1449 617 1641 735 977 873 1262 1663 1834 427 1143 488 1427 1296 1313 595 942 199 378 1413 1597 927 1415 1317 1538 178 689 877 970 1115 1249 1155 1573 326 1749 47 1452 202 247 278 1499 573 1705 170 1222 754 1850 572 1047 1433 1754 701 1791 1313 1320 393 604 607 1320 430 679 1158 1861 376 1112 920 1256 77 452 1170 1872 207 1480 168 1119 211 1446 …
Output: NO

Example 3:

Input: 1023 3255 457 812 68 469 175 256 692 998 21 55 589 733 128 481 236 902 882 945 336 487 142 395 348 802 119 493 24 982 616 996 463 883 119 732 320 619 76 665 346 809 243 570 129 703 437 991 446 610 189 444 295 748 148 307 51 957 96 599 166 1007 332 742 218 565 15 902 289 833 835 880 75 408 179 492 76 624 986 996 638 880 204 570 475 566 791 930 376 699 569 618 488 964 58 392 284 669 356 634 345 401 158 453 51 781 107 517 5 120 268 588 747 915 591 986 336 347 85 886 58 199 428 871 445 735 88 686 259 355 650 856 920 1008 748 764 908 1000 3 449 687 1009 481 912 40 341 589 885 343 869 576 870 379 857 734 882 196 602 470 698 166 872 26 923 457 958 545 802 508 974 428 864 624 717 392 923 263 1013 177 805 106 843 32 357 496 943 545 908 402 549 335 674 697 1019 109 878 8 656 158 914 194 760 342 697 …
Output: NO

Constraints:

1 <= n <= 2625; 0 <= m <= 5250; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
The Moonlit bridges of Jessa - MEDIUM Coding Problem | CodeTikki