CT58420

Last tunnels of Tailor

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Tailor the archivist watches over the tundra station of Whitesnow's stores of tunnels. 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 <= 1450; 0 <= m <= 2900; self-edges make the answer NO.

Example 1:

Input: 963 1045 141 408 234 960 221 900 164 360 365 857 348 737 679 775 10 269 214 530 328 914 493 824 437 563 303 333 108 743 8 662 114 335 319 393 257 620 249 470 918 950 133 164 328 656 747 770 31 723 23 453 506 740 182 394 330 762 31 868 391 430 306 328 524 759 22 862 179 777 57 286 171 196 532 923 67 575 14 177 901 962 142 448 36 519 568 668 394 959 163 855 361 915 236 928 308 648 68 198 721 934 531 886 450 740 290 548 455 704 253 578 361 434 363 907 235 655 180 358 521 791 245 685 575 576 407 527 568 909 844 901 196 801 583 798 495 643 474 489 694 934 302 827 93 877 435 671 110 151 547 573 489 746 311 689 146 931 761 769 705 795 303 656 144 373 352 648 149 307 504 603 212 314 43 396 395 457 74 157 866 917 212 897 149 506 656 944 166 178 198 558 49 730 362 849 3 530 126 884 10 725 609 758 40…
Output: NO

Example 2:

Input: 561 516 1 2 2 3 1 3 27 488 312 419 182 492 517 555 223 292 69 343 423 540 267 416 1 368 22 437 36 114 40 232 252 402 201 305 55 98 287 454 140 330 449 535 226 507 230 232 315 333 228 321 98 378 109 485 23 342 382 531 29 337 490 501 195 220 21 277 428 469 305 413 288 316 61 123 170 508 55 215 67 494 501 514 21 407 92 391 7 106 42 223 83 492 28 83 91 215 108 366 241 532 300 412 143 299 225 227 95 277 340 530 196 532 61 438 101 490 460 499 377 498 264 356 287 477 69 169 172 546 458 468 57 107 27 457 401 485 263 349 296 546 125 330 28 43 102 467 367 394 131 325 212 487 23 453 326 507 103 505 382 530 196 458 27 207 445 536 329 493 80 222 12 380 207 473 100 485 149 336 23 485 157 391 369 465 2 465 217 549 266 368 30 201 308 482 312 398 235 506 1 542 36 345 78 538 383 537 25 126 152 265 305 497 8…
Output: NO

Example 3:

Input: 764 2469 333 369 24 666 70 516 210 736 146 483 80 499 459 703 561 715 266 614 321 349 299 668 40 162 233 438 132 284 147 213 270 543 134 577 330 689 671 753 122 332 164 591 121 670 353 571 179 378 331 724 166 176 6 483 115 217 43 114 173 509 86 124 523 560 4 608 257 327 434 627 1 513 156 366 240 376 251 338 365 456 536 586 318 501 409 582 614 742 135 214 484 643 383 405 62 428 311 555 143 584 257 726 277 617 15 161 203 714 271 414 356 668 386 740 347 585 418 666 586 616 114 702 14 183 66 733 67 614 510 569 151 318 29 46 593 708 217 343 28 201 189 643 269 533 29 621 165 374 482 510 418 650 200 363 42 423 73 177 95 153 175 440 105 330 350 732 338 369 499 524 79 527 685 712 211 345 109 401 541 599 37 751 105 110 354 525 179 286 221 562 538 685 296 636 238 257 340 370 208 708 68 338 51 537 418…
Output: NO

Constraints:

1 <= n <= 1450; 0 <= m <= 2900; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
Last tunnels of Tailor - MEDIUM Coding Problem | CodeTikki