CT51766

The Two Guilds Beneath Beeswick

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Owen inherited the mint at the honeycomb cliffs of Beeswick along with its curious bookkeeping system for routes. Time to make sense of it. 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 <= 1152; 0 <= m <= 2304; self-edges make the answer NO.

Example 1:

Input: 17 67 2 15 7 17 8 10 6 7 6 15 5 13 1 14 6 14 11 14 2 8 12 13 2 11 2 3 7 14 2 13 7 12 16 17 1 10 9 13 1 3 2 6 8 16 7 13 8 17 4 17 4 6 8 13 3 13 7 9 3 7 4 13 10 14 2 16 6 17 7 15 11 16 3 5 15 16 9 11 3 11 3 10 4 12 4 15 5 8 9 17 4 11 1 16 1 9 12 17 8 11 4 14 1 4 6 8 14 17 1 15 1 7 1 8 2 17 1 2 13 15 6 9 5 17 3 14 11 13 5 9 11 15 2 5
Output: NO

Example 2:

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

Example 3:

Input: 1128 876 578 786 761 787 216 604 751 786 254 903 710 1081 359 928 986 1123 359 1101 133 659 234 987 609 828 161 414 647 784 85 262 122 920 331 381 214 1093 166 276 389 1029 112 943 8 543 431 624 949 1016 231 890 467 879 192 594 454 750 107 745 190 750 754 918 565 957 240 1078 685 983 292 493 18 913 599 881 368 1001 253 999 803 1007 632 743 70 764 457 709 521 927 214 576 509 654 68 733 747 1064 33 1002 164 577 339 790 38 909 869 993 718 944 87 823 116 926 24 321 509 932 244 670 323 1114 712 958 229 1064 426 691 369 931 189 999 116 136 38 1102 627 905 327 797 142 556 802 967 1023 1080 252 670 558 1066 71 969 63 1070 19 459 287 415 606 1089 512 923 517 691 787 855 216 572 285 391 334 846 829 885 383 976 300 601 90 917 325 589 825 1112 641 911 154 937 948 1006 63 462 720 1002 595 1011 63 505 3…
Output: NO

Constraints:

1 <= n <= 1152; 0 <= m <= 2304; self-edges make the answer NO.

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