CT64664

Manav's Obsidian Ledger

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Caravans arrive at the foggy moor of Greyfen with crates of corridors, and Manav the scribe must account for every last one. 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 <= 842; 0 <= m <= 1684; self-edges make the answer NO.

Example 1:

Input: 625 1479 357 469 78 227 86 96 268 421 392 394 319 415 351 415 377 408 91 456 542 604 70 446 8 554 108 462 99 260 18 257 393 520 303 520 254 458 80 398 226 442 105 595 329 610 445 575 59 325 291 514 57 483 27 306 448 524 131 353 17 393 18 200 285 453 37 582 91 470 180 314 150 489 49 125 286 610 138 253 276 316 95 194 101 350 292 348 45 222 253 534 376 590 1 393 298 565 218 454 558 623 283 608 222 306 404 479 270 537 198 209 322 427 138 320 400 508 259 398 346 500 202 592 9 547 318 602 96 354 495 556 398 479 278 390 463 466 49 91 301 370 383 479 113 457 97 129 230 410 106 201 500 605 236 581 45 553 146 480 250 350 105 335 2 95 165 273 175 547 43 299 256 401 557 618 306 418 56 413 549 603 82 220 34 408 401 618 28 552 337 603 143 300 190 322 205 211 172 419 68 283 213 421 37 166 75 496 421 564…
Output: NO

Example 2:

Input: 65 1091 23 28 33 46 13 57 47 54 38 48 57 60 11 42 10 25 3 41 5 24 56 61 17 30 23 49 48 53 2 20 55 60 17 24 26 27 53 65 28 52 15 20 29 51 26 61 5 42 3 64 8 30 9 18 17 42 28 37 36 57 11 29 7 50 27 59 44 62 8 60 16 52 13 47 33 63 30 65 6 27 52 63 20 62 43 63 9 27 3 40 3 20 40 54 10 20 17 21 5 32 21 40 14 25 20 26 1 29 23 34 11 59 28 47 55 64 19 23 4 13 39 45 2 31 21 39 22 35 17 54 5 39 14 52 13 36 1 51 5 63 44 57 25 64 35 53 15 18 17 28 9 40 8 18 13 29 20 41 11 15 41 51 11 43 26 37 15 21 52 61 38 51 54 64 56 60 6 38 5 19 39 51 17 46 29 31 2 18 34 40 35 51 51 63 25 30 29 48 13 17 44 59 20 27 7 29 7 18 10 49 7 45 35 36 24 40 7 39 16 43 16 38 1 65 30 53 16 62 8 32 25 50 24 61 8 44 28 56 26 55 24 50 48 61 25 29 11 58 29 32 41 47 23 41 9 24 49 65 21 26 62 63 51 56 21 34 30 50 30 55 36 60 32 63 12 …
Output: NO

Example 3:

Input: 268 126 1 2 2 3 1 3 78 84 75 164 50 119 91 237 25 44 116 141 21 29 233 246 172 183 14 251 65 219 158 217 35 171 38 244 9 117 158 212 138 197 148 173 137 227 53 251 50 219 19 21 20 107 16 152 32 141 5 129 45 89 42 263 44 69 1 237 193 195 111 201 120 215 29 166 32 140 34 203 71 236 161 197 57 264 47 84 103 264 5 147 90 103 118 137 99 211 33 129 64 244 8 172 67 179 126 127 18 90 133 194 109 244 124 258 18 122 176 247 70 221 217 226 119 251 39 133 177 222 134 142 9 151 63 173 146 248 176 259 58 73 244 268 240 266 43 261 142 259 172 256 60 78 93 108 52 150 147 167 207 213 25 56 122 218 50 63 21 80 118 126 98 121 52 93 127 232 1 82 23 35 199 254 36 237 131 222 142 240 46 229 188 222 74 217 154 164 22 86 95 125 198 213 166 199 150 169 70 211 51 213 89 252 246 248 94 188 84 95 138 228 130 136 195 …
Output: NO

Constraints:

1 <= n <= 842; 0 <= m <= 1684; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
Manav's Obsidian Ledger - MEDIUM Coding Problem | CodeTikki