CT42958

The Two Guilds of the Coral corridors

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Caravans arrive at the garden city of Petalbrook with crates of corridors, and Harish the customs officer 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 <= 1199; 0 <= m <= 2398; self-edges make the answer NO.

Example 1:

Input: 697 1059 1 2 2 3 1 3 65 392 297 617 243 467 107 686 293 451 100 633 161 369 97 656 294 658 573 683 354 383 450 473 605 659 279 441 80 674 304 582 416 655 271 449 134 488 532 535 331 548 73 252 209 455 438 697 94 360 248 405 192 347 440 504 287 413 256 334 11 492 645 666 255 471 205 615 58 173 97 548 397 641 40 401 47 537 182 421 395 513 474 641 481 684 23 321 166 634 69 525 350 353 488 686 404 690 187 634 77 359 326 358 101 309 25 288 47 670 439 493 188 649 167 214 88 240 483 585 638 639 186 291 329 421 261 369 557 561 572 612 226 232 254 675 434 513 298 572 355 410 15 469 192 413 324 530 445 653 543 565 90 527 267 287 600 686 117 192 130 603 129 193 351 574 130 372 132 691 82 453 97 310 194 649 224 445 179 353 284 474 68 237 78 472 121 438 48 383 230 610 492 536 79 606 14 104 327 385 204 …
Output: NO

Example 2:

Input: 762 499 279 734 493 519 353 584 561 716 100 700 79 227 586 627 144 228 310 442 358 421 465 655 144 298 283 554 166 229 212 604 400 665 16 377 97 428 376 540 84 308 104 534 187 428 41 235 99 255 73 368 53 564 418 684 65 516 33 223 566 659 188 683 473 570 310 725 160 478 206 335 425 580 35 736 39 374 350 624 155 507 399 402 177 474 32 78 82 606 80 219 370 615 349 470 74 78 182 620 239 507 375 725 21 110 173 575 177 588 181 678 228 489 155 625 170 460 435 571 265 689 3 95 423 459 144 701 37 101 414 668 455 650 388 706 631 691 176 615 36 202 205 452 610 678 16 533 171 545 23 74 74 456 372 375 74 231 694 732 80 655 78 131 202 348 106 532 75 184 272 359 269 411 53 450 535 627 6 524 320 386 64 563 156 360 255 424 242 729 14 165 303 656 333 511 185 431 402 640 462 516 162 302 565 665 229 508 648 6…
Output: NO

Example 3:

Input: 1160 16 261 389 620 1084 74 243 281 636 16 192 89 849 328 463 21 359 604 808 347 946 413 629 432 972 165 645 238 577 282 856 498 647
Output: YES

Constraints:

1 <= n <= 1199; 0 <= m <= 2398; self-edges make the answer NO.

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