CT58486

The Ashen canals of Vani

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

It is audit day at the bamboo terraces of Verdantstep. Vani spreads the canals 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 <= 2676; 0 <= m <= 5352; self-edges make the answer NO.

Example 1:

Input: 2221 625 1 2 2 3 1 3 61 1664 221 320 532 1549 1145 1978 144 1671 14 113 31 1092 284 457 156 1737 599 1229 31 459 273 617 233 975 1923 2197 67 518 623 1437 147 1161 824 1948 1336 1910 159 199 1991 2114 1704 1783 835 1739 79 1322 1113 1371 1198 1329 960 1429 1257 1815 1234 1899 668 1809 944 1524 1737 2085 22 158 173 1002 446 688 709 1439 516 1714 567 762 516 822 379 1497 518 622 344 1743 591 2065 2028 2040 489 1635 742 884 795 1271 1212 1737 924 1041 941 2064 926 2142 795 1151 316 1600 938 2110 745 1659 1159 1191 616 1783 1037 1449 880 1738 634 837 527 1161 110 1019 765 1253 706 878 1581 1833 332 618 1027 1628 1010 1881 1065 1940 903 1888 447 1516 1296 1840 651 936 215 587 631 633 530 1830 326 992 524 1218 31 269 1489 1777 530 579 1747 1913 1977 2020 1208 1388 1893 2060 788 1477 1818 2221 65…
Output: NO

Example 2:

Input: 1351 2528 1 2 2 3 1 3 438 909 601 1250 494 1001 138 679 742 1121 67 252 92 1328 466 590 389 1262 355 605 754 962 691 1250 461 815 535 702 465 1113 210 801 569 1177 599 738 128 1203 265 896 406 1183 475 1133 40 119 3 401 1186 1192 648 930 747 1195 51 458 650 720 470 500 172 704 556 959 591 1300 560 1296 591 1331 318 1258 47 1172 42 529 574 1078 29 850 319 948 454 1204 694 961 479 1030 115 295 445 873 77 135 474 927 209 407 10 43 518 668 221 417 755 1157 532 795 580 999 517 889 771 789 1046 1188 1072 1125 83 1075 82 1250 570 1076 71 959 635 1076 282 1034 503 1169 212 1102 219 346 709 913 838 1335 982 1269 491 614 51 498 342 822 325 1168 724 1307 276 512 476 905 310 1275 305 848 441 967 545 854 894 1111 961 1263 201 965 102 247 194 1211 1098 1232 130 1336 559 1194 128 1348 338 705 1065 1327 7…
Output: NO

Example 3:

Input: 1387 1952 1 2 2 3 1 3 139 595 1130 1266 186 839 188 951 205 309 35 1076 2 247 690 910 435 1349 314 379 156 1188 90 425 1015 1352 153 522 1065 1089 634 1018 1265 1324 110 132 881 1148 456 837 209 1224 20 377 1175 1209 821 1342 38 1118 303 814 435 1360 54 861 638 913 428 546 374 1023 1081 1258 562 687 673 1182 111 1129 854 1119 1025 1089 1136 1155 328 528 91 1023 789 1137 738 1011 840 893 330 1085 332 513 739 1212 66 1142 893 1319 375 1386 84 330 532 1278 542 968 67 357 867 1022 177 383 473 1190 347 387 1096 1127 294 1189 529 1309 465 552 520 650 335 554 121 277 596 729 613 635 307 1133 61 819 208 305 880 903 653 1323 183 1178 455 1284 827 1001 1059 1219 21 603 283 868 937 1146 31 1062 65 1119 55 820 843 1087 639 1098 789 792 1042 1122 874 1221 231 1387 658 661 529 1119 140 1349 757 820 578 …
Output: NO

Constraints:

1 <= n <= 2676; 0 <= m <= 5352; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.