CT44878

The Two Guilds of the Celestial roads

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Before the gates of the saffron fields of Marigold Row close for winter, Rowena must finish the roads 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 <= 1346; 0 <= m <= 2692; self-edges make the answer NO.

Example 1:

Input: 779 110 64 94 160 526 48 294 466 554 488 718 20 644 120 246 124 325 226 537 11 723 573 683 157 194 484 684 274 343 13 721 2 43 155 440 248 728 67 722 479 484 58 359 239 675 137 689 223 349 91 473 235 360 73 591 91 515 264 716 20 606 624 771 177 574 30 536 53 607 129 563 281 738 67 569 412 718 130 582 163 385 59 173 275 556 463 512 298 443 9 25 102 187 47 56 434 671 487 686 246 365 277 612 213 351 319 326 412 530 211 661 285 514 146 442 416 464 98 571 37 319 94 596 133 368 671 689 31 317 335 496 578 691 220 735 411 494 470 691 194 522 311 755 80 681 512 557 474 487 459 719 6 673 26 629 97 668 69 187 473 486 179 642 437 457 275 453 142 616 62 655 639 662 318 553 281 623 562 651 430 447 276 429 362 614 135 171 670 754 513 735 660 677 281 758 351 585 599 719 506 631 318 609 145 301 14 568 199 …
Output: YES

Example 2:

Input: 197 967 59 89 141 146 141 180 141 148 21 56 65 173 15 16 7 145 97 189 40 167 1 157 10 16 59 133 5 187 38 58 88 132 129 183 61 105 62 188 118 142 52 167 41 115 39 106 60 63 88 176 78 98 152 168 109 158 7 185 35 37 37 45 55 150 2 193 16 147 7 119 23 137 34 139 9 120 24 159 64 191 59 113 107 163 5 162 68 163 36 147 56 161 105 161 36 66 35 86 93 108 29 90 45 102 130 181 54 193 90 99 21 170 74 185 110 147 49 147 29 161 139 157 71 108 121 191 19 151 21 52 94 187 196 197 122 134 100 155 131 165 43 167 33 140 46 195 101 141 17 143 126 142 70 162 41 117 72 191 27 31 3 19 19 60 60 156 119 176 41 157 104 129 9 148 117 165 12 172 67 193 55 138 87 170 145 156 13 88 57 157 82 114 37 69 80 144 170 191 88 99 29 78 8 37 36 171 135 197 120 165 2 124 53 117 73 186 83 94 81 197 180 183 11 66 77 197 44 190 134…
Output: NO

Example 3:

Input: 264 199 75 80 1 68 141 222 193 229 190 199 69 218 50 228 64 124 118 227 11 29 22 160 44 183 186 221 93 110 70 150 70 168 105 126 65 144 194 232 155 158 54 223 90 261 6 197 2 202 98 221 91 205 197 201 6 136 59 263 90 112 180 219 125 184 11 194 175 237 201 248 101 110 51 172 191 224 179 184 143 190 258 260 56 219 41 72 59 82 118 238 65 253 65 122 34 40 48 229 83 165 24 205 69 123 9 23 30 131 80 213 21 129 89 255 55 258 203 213 77 87 248 262 121 177 197 245 28 179 8 226 54 115 56 85 150 227 164 241 86 216 179 247 72 133 192 215 122 230 165 193 46 264 195 263 116 171 45 228 68 196 186 264 55 116 70 208 175 211 61 70 35 73 94 204 83 151 58 233 61 72 74 240 204 250 188 200 162 232 4 230 162 188 96 142 1 40 8 174 162 182 31 89 36 183 34 134 130 146 47 155 26 31 118 141 57 75 47 227 53 68 7 210 18…
Output: NO

Constraints:

1 <= n <= 1346; 0 <= m <= 2692; self-edges make the answer NO.

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