CT37418

The Whispering roads of Nico

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The harbor bell rings at the old quarter of Brasshaven; Nico weighs the day's roads manifests and starts the calculations. 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 <= 2582; 0 <= m <= 5164; self-edges make the answer NO.

Example 1:

Input: 1253 4779 287 843 556 713 358 571 792 1090 605 913 10 757 668 1113 406 1228 608 609 189 261 253 1011 26 76 615 809 211 919 445 460 1127 1246 1090 1185 45 392 820 1156 102 672 34 1149 436 727 58 116 137 1234 852 1022 221 238 864 1181 536 1086 76 806 1085 1093 82 1191 217 1111 512 796 282 981 218 1016 616 699 267 708 536 671 621 902 853 984 120 152 146 519 108 531 387 774 209 679 19 73 446 784 946 1055 780 800 4 693 16 899 730 1230 447 1222 745 1003 861 1116 552 1056 818 1120 708 1170 175 935 152 457 723 1135 660 1016 76 189 370 827 199 473 563 1249 234 591 95 592 1068 1147 116 906 1085 1207 682 899 94 219 239 439 832 1140 498 852 895 920 142 267 445 912 1016 1098 527 972 818 1085 104 1201 140 1196 558 864 194 680 731 802 373 1024 464 976 763 1173 462 1243 1099 1124 162 1061 810 1049 416 106…
Output: NO

Example 2:

Input: 1166 507 1 2 2 3 1 3 890 1104 464 1157 583 937 13 119 960 1142 642 821 533 700 520 1012 44 968 540 892 916 1002 636 838 462 510 10 765 943 1114 118 1141 307 891 117 626 584 1053 25 825 84 582 91 226 971 1021 117 185 135 746 525 697 145 199 36 292 186 391 94 547 393 767 599 1027 513 938 976 1122 317 437 29 284 431 1144 154 1012 189 580 836 876 382 908 347 1129 607 1113 180 453 450 520 496 690 554 580 174 1164 437 925 506 1016 193 585 1058 1099 248 983 791 914 91 768 550 625 219 888 456 655 483 1132 31 480 145 620 122 270 229 666 211 1028 315 345 109 192 56 901 778 891 959 1041 261 1028 143 172 321 560 90 528 232 755 696 804 998 1059 257 390 290 443 322 1133 234 1102 252 624 33 1113 176 848 69 440 101 456 801 1136 251 740 212 476 62 769 573 905 276 559 701 771 102 356 614 1158 79 424 440 556…
Output: NO

Example 3:

Input: 1007 4677 102 577 414 990 31 565 399 891 132 709 403 731 302 691 37 45 357 994 741 834 691 726 146 435 748 798 226 787 342 497 208 410 51 735 614 976 328 544 505 956 389 847 293 343 509 687 349 436 560 916 27 349 475 774 952 971 501 687 555 722 619 920 669 784 313 783 145 253 357 765 366 440 186 616 254 871 454 795 758 948 547 661 240 891 444 498 18 888 424 514 241 710 493 692 35 145 318 634 823 920 51 1006 229 243 215 915 8 113 210 341 666 713 409 651 638 667 577 691 90 499 245 961 324 852 54 198 729 841 381 764 301 344 574 909 178 789 361 416 393 544 150 900 294 655 558 888 287 893 324 687 247 808 379 629 697 967 797 919 124 980 764 990 601 948 654 725 2 105 730 920 549 613 134 965 494 629 258 327 560 781 656 880 501 1005 146 493 410 440 828 851 821 894 1 58 450 895 532 741 212 240 312 7…
Output: NO

Constraints:

1 <= n <= 2582; 0 <= m <= 5164; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
The Whispering roads of Nico - MEDIUM Coding Problem | CodeTikki