CT57684

Dev's roads Reckoning

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

It is audit day at the gull cliffs of Screech Point. Dev spreads the roads records across the table and picks up a sharp pencil. 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 <= 1940; 0 <= m <= 3880; self-edges make the answer NO.

Example 1:

Input: 157 2703 50 95 93 133 88 107 2 61 40 119 15 78 11 49 36 81 92 114 113 141 53 119 39 119 53 61 24 119 47 55 12 53 106 116 35 141 81 103 15 122 16 150 27 91 92 120 27 137 26 132 62 153 78 85 18 135 119 130 40 77 49 98 22 157 102 134 8 128 16 33 49 101 81 117 96 115 5 69 76 126 9 27 55 138 35 125 65 120 43 65 36 123 103 106 76 94 30 97 122 157 113 152 58 76 28 146 15 54 60 63 40 118 58 134 48 123 36 58 50 103 111 142 9 90 3 95 53 112 49 91 30 51 29 112 28 80 63 66 13 121 57 140 63 111 133 140 19 147 48 63 39 151 123 127 30 54 24 128 19 86 12 28 92 115 30 100 85 128 52 113 35 87 15 75 43 75 89 132 90 142 110 139 19 117 106 137 52 78 46 64 106 132 11 118 20 97 60 98 7 55 60 155 10 16 80 102 124 143 69 135 33 94 26 27 4 135 74 128 66 154 111 114 11 27 126 130 14 110 39 105 8 67 39 106 7 102 91 1…
Output: NO

Example 2:

Input: 1910 1130 450 1712 576 597 452 1259 241 834 992 1426 605 1598 829 1027 504 518 946 1026 15 602 508 1381 96 778 686 1829 109 501 785 1878 1387 1484 225 610 278 1096 382 943 685 1118 240 468 495 1294 966 1524 188 624 48 1444 1085 1271 785 998 699 723 187 1184 25 1304 371 982 1017 1287 532 739 1655 1776 271 983 1041 1703 957 1420 1333 1763 80 1250 330 1730 224 1108 257 749 1196 1842 1106 1802 39 1720 388 1088 1075 1186 400 701 521 558 28 1087 1628 1901 404 1630 130 411 520 730 76 1351 236 563 469 1072 1200 1466 254 486 125 1784 623 831 1628 1835 396 892 485 1301 15 405 1162 1489 901 1097 1235 1667 158 535 403 1687 375 1451 1743 1824 839 1699 292 1139 517 907 764 1214 1135 1408 1338 1716 616 1489 1470 1783 32 456 1543 1587 794 1781 737 979 636 1257 912 1448 882 1789 1086 1824 663 1797 943 1338…
Output: NO

Example 3:

Input: 1049 3409 688 852 696 720 818 947 255 487 320 407 792 1027 841 992 96 955 487 1045 719 1036 532 787 660 736 161 735 168 597 5 799 168 733 423 659 104 916 39 987 374 688 242 807 16 78 127 355 533 854 74 708 171 665 234 683 340 860 170 419 263 807 655 766 66 1030 432 565 385 480 435 516 323 400 193 823 71 681 309 372 160 683 485 884 304 606 706 766 116 508 281 325 82 759 710 1021 381 786 364 919 364 766 231 1038 488 968 86 225 44 816 136 217 957 975 38 1007 91 513 229 891 513 651 558 573 43 435 426 658 519 1024 631 881 593 648 116 392 220 405 544 643 314 658 379 582 443 796 540 897 202 645 305 487 348 629 402 482 420 802 408 508 111 997 133 805 307 511 371 519 174 482 125 509 223 773 312 670 934 1007 181 203 157 163 440 686 452 786 82 221 63 470 295 716 182 421 846 876 140 950 327 600 515 87…
Output: NO

Constraints:

1 <= n <= 1940; 0 <= m <= 3880; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
Dev's roads Reckoning - MEDIUM Coding Problem | CodeTikki