CT57406

The Two Guilds of Blackglass

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Before the gates of the obsidian flows of Blackglass close for winter, Farmer must finish the corridors 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 <= 781; 0 <= m <= 1562; self-edges make the answer NO.

Example 1:

Input: 321 145 145 265 84 297 87 126 33 264 248 311 224 314 153 305 157 182 81 111 310 314 125 172 138 202 5 259 31 70 80 245 30 319 7 37 76 140 79 314 25 86 56 240 282 301 82 122 239 312 18 123 38 59 85 89 88 215 7 216 68 289 256 265 40 69 62 135 148 151 34 180 85 279 159 240 265 315 145 294 139 143 173 261 78 234 20 255 95 279 92 316 253 309 135 229 65 294 151 193 182 291 284 310 3 155 91 155 83 284 126 309 85 159 86 176 59 127 197 210 14 73 8 42 2 275 181 200 33 306 63 310 20 252 72 253 2 174 19 279 159 321 12 53 2 58 184 248 124 213 232 297 28 311 190 278 48 133 109 284 181 255 113 278 75 243 59 98 213 312 115 245 128 320 32 130 155 249 94 198 75 276 211 306 193 211 221 267 94 109 47 307 33 172 99 190 111 253 20 147 98 223 208 234 197 200 94 258 154 270 29 271 42 116 31 311 142 305 72 94 180 …
Output: YES

Example 2:

Input: 471 434 1 2 2 3 1 3 27 266 189 432 13 136 192 418 117 415 103 164 167 298 66 383 384 398 297 394 30 348 55 308 85 157 277 394 122 437 225 273 320 403 64 141 266 396 205 436 96 353 148 346 178 319 8 466 224 298 184 333 83 164 204 239 186 409 265 421 270 287 359 465 437 458 223 405 112 268 136 165 32 163 59 453 306 348 220 300 140 184 72 454 153 334 408 427 280 390 136 424 227 292 257 427 1 69 101 286 373 461 204 338 53 188 178 341 363 403 32 180 280 437 134 254 13 332 28 37 146 234 63 347 79 185 143 429 265 357 77 290 42 216 226 301 97 292 41 217 408 449 255 407 375 442 111 420 104 419 67 161 280 366 168 262 182 221 88 164 108 342 317 381 124 164 195 353 55 427 116 452 74 186 422 451 313 460 395 399 33 417 90 142 194 238 348 382 152 364 181 346 237 319 383 400 34 211 112 387 38 392 136 449 …
Output: NO

Example 3:

Input: 416 420 130 405 216 344 2 384 67 232 372 375 82 191 18 159 83 308 135 138 17 82 128 361 283 335 19 415 187 190 280 370 260 395 86 94 120 245 144 388 93 318 341 382 48 308 132 284 332 365 175 197 12 99 236 318 72 189 213 301 104 411 33 250 202 305 127 142 97 120 121 335 8 13 143 255 137 198 322 395 8 274 135 259 218 239 91 258 216 224 231 335 103 299 49 89 179 219 192 390 37 109 204 208 92 335 42 303 71 151 222 286 22 78 203 204 167 330 250 276 67 256 74 132 186 365 215 236 91 121 172 374 39 150 199 239 341 366 81 389 286 382 32 216 28 135 38 157 157 231 90 356 20 34 119 398 114 324 330 383 68 403 319 403 206 416 235 355 12 295 404 405 67 360 267 326 34 322 74 169 68 110 88 118 48 111 9 372 348 384 230 330 182 387 163 225 213 247 142 389 194 217 188 400 37 354 250 329 140 372 257 292 99 214…
Output: NO

Constraints:

1 <= n <= 781; 0 <= m <= 1562; self-edges make the answer NO.

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