CT38725

Quin Counts the routes

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

At the savanna camp of Amberplain, Quin records each routes in a worn leather ledger. The guild wants answers, not guesses. 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 <= 1565; 0 <= m <= 3130; self-edges make the answer NO.

Example 1:

Input: 142 2 1 2 2 3
Output: YES

Example 2:

Input: 588 1616 1 2 2 3 1 3 130 576 115 226 192 407 565 574 308 550 388 487 66 200 129 327 395 566 383 520 40 454 211 515 47 109 262 311 533 574 64 454 151 219 75 78 186 462 16 283 56 133 105 359 300 440 87 469 69 252 459 505 427 476 308 502 392 479 253 526 17 66 261 298 168 216 59 185 81 576 439 455 94 535 332 335 25 459 251 494 138 369 363 458 194 305 366 429 96 258 374 429 41 70 103 315 418 505 254 442 386 478 140 581 34 553 40 346 389 542 354 585 344 460 175 467 200 507 168 587 85 442 376 411 377 399 63 218 85 234 164 443 159 476 56 472 102 523 23 264 319 534 73 207 210 381 303 455 86 88 230 500 49 480 223 304 79 384 22 49 230 281 281 284 5 184 240 253 292 303 79 561 58 86 78 91 396 401 254 374 145 343 49 490 79 472 183 301 323 544 78 448 115 516 82 150 153 213 201 233 154 196 337 585 372 498…
Output: NO

Example 3:

Input: 991 1157 817 893 143 230 13 686 242 456 378 392 263 458 232 366 199 271 284 460 860 920 636 951 148 713 586 712 826 896 307 849 481 854 499 798 549 733 14 204 55 979 31 180 526 557 93 661 137 709 102 201 256 560 2 271 60 392 357 858 640 811 262 470 105 447 117 621 244 870 134 805 668 767 16 250 350 399 50 430 207 896 340 925 790 896 6 494 377 422 7 615 122 880 59 907 332 609 416 669 169 647 351 526 185 475 425 808 3 679 550 567 813 887 544 988 738 855 275 427 467 673 494 943 30 717 247 580 359 622 17 165 7 507 173 820 237 448 193 892 18 543 98 834 292 878 216 416 216 460 40 571 604 881 802 944 425 757 242 954 84 300 166 804 9 950 4 936 416 596 763 777 846 904 701 899 85 384 141 898 262 824 14 232 610 900 103 300 732 790 184 560 892 914 71 758 680 687 665 727 5 810 801 962 156 339 412 607 3…
Output: NO

Constraints:

1 <= n <= 1565; 0 <= m <= 3130; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
Quin Counts the routes - MEDIUM Coding Problem | CodeTikki