CT57452

Last tunnels of Warden

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Warden the auditor watches over the lantern lake of Firefly Mere'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 <= 2372; 0 <= m <= 4744; self-edges make the answer NO.

Example 1:

Input: 1218 3944 130 1069 33 153 507 878 197 802 526 871 286 776 616 693 344 687 681 952 763 809 693 858 158 704 180 911 901 971 206 652 83 1159 164 1134 486 694 18 907 277 1170 84 619 351 1183 90 949 414 761 385 952 142 724 213 720 440 1068 618 907 373 822 448 454 1106 1181 712 1087 596 613 405 597 269 278 54 902 1029 1033 190 532 4 235 1120 1201 743 1061 151 447 478 902 271 1158 695 882 453 520 263 1217 70 580 191 923 472 1031 1098 1122 118 952 589 1026 1007 1118 238 1014 619 817 373 849 313 722 976 1067 618 830 764 829 65 216 883 1101 826 1166 58 251 330 1210 40 865 195 273 274 1168 882 1193 71 505 762 1169 883 958 289 920 407 502 368 1072 750 875 538 673 224 665 1109 1126 601 719 537 912 22 91 202 1014 703 822 139 808 1093 1162 541 813 563 1133 665 946 264 841 75 538 182 1159 670 793 509 889 …
Output: NO

Example 2:

Input: 1630 169 23 245 394 831 662 868 335 821 542 1492 685 1602 746 1113 904 1310 484 666 307 1521 2 217 297 951 131 226 621 1036 1127 1459 281 970 1121 1604 624 966 155 1584 626 952 908 1521 610 1001 1306 1439 540 1253 268 1521 617 1059 730 833 612 953 238 977 656 753 763 1074 616 1307 663 1220 853 1239 259 410 63 843 323 1148 231 411 717 1003 947 1389 439 1521 1163 1178 266 1420 656 1537 1249 1286 636 721 163 896 179 1030 836 1437 183 1186 745 847 219 1414 871 949 337 1339 792 815 381 567 852 1489 595 1001 285 838 280 1596 871 1368 562 1033 38 702 170 547 1072 1116 294 1597 198 1403 265 1333 771 1402 890 1096 1230 1531 1515 1624 869 1229 112 1445 134 1563 390 581 327 1351 572 931 138 1548 605 1572 1081 1352 436 564 438 485 706 1048 41 422 1010 1504 241 1195 84 849 732 1452 846 1422 823 1594 62…
Output: YES

Example 3:

Input: 165 685 76 92 75 99 43 107 56 93 3 22 14 23 53 61 102 130 74 110 25 113 12 48 5 12 70 122 51 55 65 74 65 119 130 146 107 151 28 109 15 42 51 126 93 113 36 91 39 113 59 71 3 106 85 131 101 120 47 87 89 92 69 85 95 103 52 66 44 55 19 160 153 165 57 78 60 145 24 134 102 142 1 144 101 156 65 130 42 154 78 147 31 52 30 100 17 18 43 82 31 50 105 135 112 157 48 75 136 152 89 126 8 27 4 66 29 87 9 122 13 125 31 153 63 134 16 42 100 164 82 103 34 89 91 133 142 151 95 143 47 132 76 86 92 163 13 24 76 114 22 25 51 134 46 162 95 137 39 154 17 78 88 164 25 103 6 47 52 130 2 111 22 32 7 43 78 92 30 88 48 132 18 161 56 58 38 118 67 88 114 127 68 161 112 144 40 52 15 28 52 114 115 149 37 120 32 107 112 143 10 106 72 119 101 109 114 115 24 114 20 56 12 79 6 115 122 158 17 45 22 138 68 117 125 150 40 84 61 …
Output: NO

Constraints:

1 <= n <= 2372; 0 <= m <= 4744; self-edges make the answer NO.

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