CT37245

Bhavi's corridors Two Guilds

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Bhavi the valuer watches over the temple city of Sunspire's stores of corridors. A careful computation stands between order and chaos. 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 <= 2314; 0 <= m <= 4628; self-edges make the answer NO.

Example 1:

Input: 497 1829 234 479 370 426 217 363 135 187 295 416 128 238 186 480 247 387 267 443 160 370 488 497 139 274 208 342 95 416 212 286 10 163 42 170 48 452 222 448 60 253 385 483 264 418 402 497 246 352 236 362 387 448 256 257 118 186 15 448 266 424 144 456 20 429 316 337 6 268 113 359 187 233 90 384 222 383 98 344 163 333 147 454 109 396 67 108 316 411 140 449 77 431 260 276 153 368 201 408 132 484 262 268 67 73 176 228 38 340 57 397 165 207 82 167 41 413 164 251 106 364 221 295 91 124 101 473 413 461 244 309 211 329 319 329 98 287 293 419 250 275 87 93 79 447 484 491 51 65 125 365 33 467 41 237 281 385 246 353 457 469 226 495 81 168 117 371 180 398 60 273 259 362 257 435 36 293 226 440 218 476 95 145 260 286 46 83 178 468 196 306 116 381 222 408 64 418 42 88 208 273 119 366 95 333 143 395 465 4…
Output: NO

Example 2:

Input: 407 1162 1 2 2 3 1 3 176 211 67 159 95 388 13 392 18 62 58 160 23 251 34 375 164 365 327 356 160 173 97 349 113 383 187 269 175 218 67 231 116 370 285 355 371 372 11 313 205 292 24 82 124 277 22 302 1 15 17 314 8 147 114 215 78 398 196 281 74 241 4 368 138 277 40 263 148 252 116 237 69 148 179 310 244 259 45 111 229 293 73 118 217 221 59 357 52 397 34 134 339 343 23 81 36 62 41 66 316 403 381 385 239 339 242 399 212 250 191 266 163 322 192 332 142 321 208 276 128 142 154 261 142 184 225 302 16 276 65 354 175 219 103 231 10 328 312 340 218 221 195 398 330 332 274 302 352 399 111 261 275 285 48 261 53 117 56 68 75 373 39 132 377 386 212 404 142 296 41 228 347 379 56 150 87 163 87 398 49 60 178 325 20 369 276 358 112 376 40 150 142 390 233 297 148 201 208 236 260 261 286 375 209 242 265 311 3…
Output: NO

Example 3:

Input: 697 1044 38 606 33 278 607 630 447 647 243 604 75 167 171 571 400 649 53 668 145 673 5 188 312 470 541 553 376 501 139 425 151 405 253 254 19 399 112 235 230 646 45 331 5 183 232 286 207 283 126 624 190 277 182 642 68 366 246 340 95 169 58 461 493 552 534 583 382 516 157 199 329 532 499 602 122 433 72 222 125 391 160 459 353 690 434 686 211 583 234 571 36 182 152 613 39 465 207 385 134 180 184 575 441 688 172 239 288 600 335 420 115 539 539 650 202 241 143 628 35 432 514 605 6 84 103 223 215 255 35 598 142 403 455 646 134 214 167 550 132 603 100 538 365 421 65 284 271 373 276 413 397 486 408 557 314 667 84 341 85 518 351 682 209 665 70 618 37 192 18 25 280 434 7 163 63 505 262 672 164 392 505 518 142 176 463 572 414 468 120 158 113 530 292 315 129 643 269 355 291 631 545 638 19 462 128 255…
Output: NO

Constraints:

1 <= n <= 2314; 0 <= m <= 4628; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
Bhavi's corridors Two Guilds - MEDIUM Coding Problem | CodeTikki