CT65088

The Prismatic canals of Blythe

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Blythe runs the apiary at the snowberry thicket of Winterholt. Today the books show a list of canals, and the numbers must be worked out before sundown. 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 <= 1433; 0 <= m <= 2866; self-edges make the answer NO.

Example 1:

Input: 803 122 1 2 2 3 1 3 130 637 186 210 237 585 365 520 37 140 304 558 625 786 221 371 30 62 423 449 488 716 35 676 261 357 243 665 306 480 359 639 203 375 190 358 116 708 269 644 479 514 6 169 7 252 60 384 151 590 485 639 323 367 101 689 155 270 64 603 115 383 73 623 239 506 28 519 329 686 447 675 471 728 163 670 555 774 37 538 219 314 454 624 48 202 162 714 26 437 210 703 145 195 3 709 108 539 401 561 529 639 423 627 252 521 239 418 383 565 489 520 441 540 82 345 335 590 97 112 443 574 226 364 390 461 284 631 232 345 160 382 384 483 373 374 169 753 494 539 8 600 354 718 192 371 281 336 504 513 162 315 600 716 269 710 352 763 158 344 154 320 121 182 451 478 607 674 340 656 494 500 518 693 18 729 247 344 71 430 607 785 242 351 543 646 31 158 162 743 12 196 26 153 99 607 125 210 248 652 369 803…
Output: NO

Example 2:

Input: 732 1817 1 2 2 3 1 3 40 88 74 499 557 572 407 440 116 699 517 644 352 472 134 434 333 589 183 347 117 513 301 652 425 462 356 569 279 494 145 579 140 319 453 667 155 632 21 657 93 540 351 629 305 666 167 252 24 617 156 715 352 399 229 475 681 719 389 444 245 657 387 520 123 211 729 732 390 564 96 521 339 716 549 603 201 332 23 422 219 724 291 387 111 532 434 643 488 527 200 514 541 571 606 705 126 281 124 464 316 402 118 161 222 302 370 626 33 78 394 514 106 169 24 471 166 663 88 150 65 138 103 643 498 566 399 449 103 199 582 723 494 624 6 64 110 381 259 289 192 641 226 380 18 78 538 631 578 686 271 686 186 699 121 216 405 478 381 728 102 460 131 210 159 588 211 673 35 719 110 487 17 451 257 675 329 557 483 614 180 675 253 277 400 675 236 488 105 208 667 704 519 585 411 670 113 240 93 644 …
Output: NO

Example 3:

Input: 751 1913 1 2 2 3 1 3 516 687 89 180 397 480 467 630 434 435 508 698 252 371 70 193 118 235 146 501 402 595 633 650 121 259 65 547 555 622 497 583 224 543 213 300 100 190 157 520 251 253 38 536 56 692 195 590 26 85 197 452 350 709 61 211 495 637 335 711 60 351 88 215 110 657 305 677 50 591 20 539 337 345 426 669 186 274 558 724 65 634 609 735 183 214 140 426 162 535 219 409 335 529 259 336 504 634 339 592 63 182 206 449 167 294 239 475 315 715 31 570 168 196 94 746 483 669 83 328 556 733 77 738 419 566 292 597 2 169 213 348 623 722 268 343 265 300 369 588 129 458 223 330 91 281 238 598 269 471 424 489 285 313 60 702 618 651 92 735 220 565 162 173 3 648 322 434 468 742 121 655 289 456 547 705 202 433 564 728 697 705 157 366 12 681 248 621 310 566 457 664 297 338 181 445 81 669 41 200 158 557…
Output: NO

Constraints:

1 <= n <= 1433; 0 <= m <= 2866; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
The Prismatic canals of Blythe - MEDIUM Coding Problem | CodeTikki