CT50817

Whispering corridors Two Guilds

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Caravans arrive at the dune sea of Caravanrest with crates of corridors, and Lysander the store warden must account for every last one. 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 <= 2061; 0 <= m <= 4122; self-edges make the answer NO.

Example 1:

Input: 2003 201 255 305 95 2002 400 1325 452 1347 477 980 757 1767 41 1279 20 1222 153 1061 214 1147 21 2000 931 1448 183 863 78 229 1029 1791 245 1502 153 1313 1044 1070 353 1946 185 748 671 1586 986 1373 773 1676 1113 1539 826 1362 672 802 596 1094 619 749 1164 1843 78 251 927 1658 243 1965 492 519 1486 1642 664 844 97 379 105 346 429 1751 101 157 577 829 263 1665 1618 1735 369 1492 872 1969 303 1379 475 1131 107 824 220 1733 533 1999 862 1488 1162 1323 89 706 1298 1615 167 352 600 1877 988 1418 1596 1836 894 2000 258 821 1275 1796 373 1374 652 1449 935 1904 611 1310 750 1882 658 880 985 1642 884 1690 1604 1705 361 1550 934 1093 1322 1556 661 1686 332 1439 244 1937 1301 1639 399 1429 100 1982 249 548 372 1950 757 763 121 523 180 1540 742 1689 430 732 979 1133 299 1643 270 1836 1399 1814 174 157…
Output: YES

Example 2:

Input: 155 920 29 46 54 107 61 83 55 120 4 121 66 153 52 105 117 124 13 147 31 75 2 74 100 139 73 152 62 111 96 118 48 97 101 129 31 152 100 119 87 140 84 90 45 130 2 7 10 24 31 61 7 39 92 142 51 68 31 94 48 76 38 155 74 138 63 135 51 132 87 90 26 71 12 41 4 113 23 136 107 121 41 142 27 50 19 134 31 148 34 130 96 113 95 116 101 152 69 79 107 120 3 56 42 61 97 116 82 92 61 109 6 142 82 128 72 115 72 101 81 145 12 107 8 14 43 142 127 139 61 119 44 67 16 107 6 96 51 106 82 107 42 146 28 133 98 134 57 112 71 145 51 65 134 141 8 45 5 69 30 98 67 126 133 149 92 109 9 91 8 33 120 148 72 146 79 133 80 143 27 59 56 95 30 106 54 151 9 110 80 118 18 108 21 73 13 70 2 139 69 90 71 154 3 78 123 138 56 148 88 132 12 64 6 14 51 113 41 104 35 64 64 75 38 146 40 84 3 83 40 93 147 154 69 117 56 129 59 109 45 110 3…
Output: NO

Example 3:

Input: 1618 4085 1349 1585 40 134 1200 1355 1281 1282 715 1323 294 1386 111 876 36 41 459 605 956 1131 98 566 539 1245 65 196 5 50 998 1569 371 401 311 660 59 1394 71 627 103 260 1024 1156 1317 1586 631 1049 887 1456 1057 1259 833 985 101 791 1015 1210 146 1287 179 634 940 1296 57 588 255 1185 627 781 116 1106 678 731 183 865 322 896 128 1114 327 1576 28 890 474 1188 1049 1549 1070 1098 780 1143 49 130 272 989 499 575 190 645 368 1378 475 825 1124 1210 1 764 39 174 342 693 185 1285 495 605 665 923 877 1343 1180 1613 39 149 771 1005 9 1477 653 685 694 1155 73 1058 292 485 120 1063 863 1331 970 1028 642 676 231 1101 297 1471 355 1271 455 1609 1186 1421 198 803 140 638 120 234 1036 1106 538 1017 1057 1474 406 1042 704 878 705 1535 543 663 709 1184 13 390 620 1155 1313 1580 415 1085 519 1182 1035 137…
Output: NO

Constraints:

1 <= n <= 2061; 0 <= m <= 4122; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
Whispering corridors Two Guilds - MEDIUM Coding Problem | CodeTikki