CT63569

Omkar and the Two Guilds

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Omkar inherited the dairy at the ember mines of Cindercrag along with its curious bookkeeping system for bridges. 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 <= 1063; 0 <= m <= 2126; self-edges make the answer NO.

Example 1:

Input: 620 1339 132 154 23 212 74 521 269 599 193 489 248 343 147 377 15 56 301 545 302 485 303 451 230 328 474 480 164 520 118 375 374 548 303 539 134 293 224 429 421 433 396 420 193 511 149 200 232 479 2 546 59 487 43 519 15 439 397 605 338 616 238 609 126 617 146 486 6 188 126 145 16 483 102 328 281 581 79 107 33 91 283 368 241 360 146 487 238 450 369 459 281 475 386 580 533 534 17 360 104 361 53 351 316 567 182 281 428 473 359 424 135 372 286 608 141 297 27 583 172 537 133 278 216 242 10 479 66 606 27 258 252 485 255 338 318 485 554 575 477 592 270 491 159 593 377 505 73 459 136 518 142 247 161 423 120 174 173 387 66 259 1 372 5 600 346 415 322 565 424 506 56 268 246 506 341 544 322 573 361 596 266 380 110 131 91 292 419 471 167 185 370 529 273 280 103 578 98 517 265 533 220 430 344 388 131 4…
Output: NO

Example 2:

Input: 410 246 237 263 231 285 220 260 100 238 51 369 87 211 59 208 16 88 138 342 44 336 109 249 81 271 39 43 184 231 192 326 57 314 160 329 23 163 126 384 233 401 314 381 119 317 42 318 122 180 165 194 219 266 197 409 68 216 96 314 351 373 19 128 191 283 66 279 16 319 163 232 80 189 96 123 78 400 44 314 176 194 155 280 67 167 230 334 14 76 74 138 101 239 23 165 218 244 22 132 305 377 74 325 46 126 78 254 330 400 109 195 278 289 31 77 225 275 175 377 10 65 86 348 287 335 157 185 298 354 4 65 84 370 86 392 33 251 193 329 90 332 18 132 307 355 173 377 95 179 8 83 263 355 108 356 203 344 42 64 1 398 34 246 121 348 64 226 267 405 25 190 144 285 75 364 256 369 6 229 197 326 334 393 14 378 8 383 262 339 193 311 100 201 120 170 2 324 141 313 18 107 147 190 27 210 52 144 154 310 298 350 366 375 280 299 5…
Output: YES

Example 3:

Input: 207 157 93 206 53 177 91 204 31 195 3 198 76 200 160 185 149 155 2 33 40 202 61 139 122 177 95 184 42 177 51 180 70 164 126 183 49 197 4 90 18 67 124 153 85 156 97 152 2 198 123 204 35 174 81 131 73 97 39 119 133 174 107 155 3 158 25 55 93 123 74 125 54 137 10 153 29 179 44 200 20 56 37 103 132 206 125 202 28 73 31 139 104 111 21 185 93 140 23 65 64 119 66 79 73 116 106 206 49 107 32 207 190 194 109 124 13 140 6 131 105 203 47 77 121 143 54 181 59 202 121 130 79 106 119 157 161 205 38 123 24 161 117 187 31 94 92 93 97 178 119 203 120 142 91 103 67 81 110 141 12 13 45 100 10 190 73 74 31 205 8 172 91 202 37 188 97 163 106 136 38 109 98 100 85 173 37 100 60 66 34 195 64 116 71 131 80 120 22 56 110 191 56 132 56 142 105 123 110 147 108 206 130 139 145 169 34 153 83 143 40 118 16 74 61 113 1 1…
Output: NO

Constraints:

1 <= n <= 1063; 0 <= m <= 2126; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
Omkar and the Two Guilds - MEDIUM Coding Problem | CodeTikki