CT64268

The Two Guilds of the Solar tunnels

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Every season at the ink district of Scriptoria, someone must document the rare sighting. This year the task falls to Chandler, armed only with the tunnels register. 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 <= 2873; 0 <= m <= 5746; self-edges make the answer NO.

Example 1:

Input: 1787 4711 66 1341 440 1702 842 1196 116 1080 380 480 1010 1329 435 841 165 325 1410 1642 533 845 1133 1151 280 514 339 680 870 1192 292 469 378 657 808 1197 15 374 1401 1680 473 717 675 1716 1297 1327 491 978 465 1124 79 1701 897 1295 255 345 315 1308 548 1111 711 790 375 1075 356 652 540 1581 434 1021 537 768 61 669 332 1663 44 912 111 1673 432 1265 505 1230 393 744 200 455 602 787 227 794 525 1055 241 1346 333 1740 80 1476 744 1437 214 1058 249 676 374 537 194 327 271 730 1282 1471 771 1476 45 1725 1299 1627 1287 1389 1028 1739 589 1705 395 1776 1288 1702 986 1489 13 590 116 1106 1522 1643 967 1318 507 779 531 1340 1021 1508 48 533 214 1719 654 1358 325 876 534 1592 234 1394 1013 1390 531 1574 59 762 555 945 1340 1597 703 1077 703 1446 897 1034 241 244 98 641 426 737 679 1441 284 1685 32…
Output: NO

Example 2:

Input: 2790 5036 583 1934 1260 1907 1255 2114 1968 2082 562 637 623 1149 644 2400 1365 2543 245 1513 986 2654 209 2374 200 1582 1553 2649 1214 2077 1683 2428 1037 1173 419 2038 512 1263 146 1843 882 1037 22 1577 138 1227 1358 1753 231 2047 712 1893 414 2695 2633 2646 816 1329 157 678 248 2390 1831 2727 265 1255 1111 2140 1995 2007 1496 2558 1304 2074 407 2078 791 1719 518 2623 1926 2104 2471 2520 1825 2353 10 1492 1263 2528 168 2331 1511 2113 786 953 200 2293 92 1733 319 1290 29 1605 2457 2683 179 2421 1202 1216 1726 2773 511 1396 232 1271 604 2714 731 2705 738 1858 643 650 1755 1917 31 786 407 1452 1384 2238 406 1308 523 1245 2008 2171 794 1698 1472 2230 329 1824 537 2256 764 2129 535 2396 383 1170 136 224 1258 1505 1460 2455 2662 2670 677 2697 152 2700 303 2692 1435 2335 1185 1271 3 1016 2124 2…
Output: NO

Example 3:

Input: 1520 1386 1 2 2 3 1 3 124 1028 530 893 780 1296 41 375 851 1117 143 445 751 1210 272 298 102 1151 144 448 360 1482 149 1272 1135 1205 501 1168 26 160 1456 1506 121 703 224 1459 340 1128 889 1291 818 1284 51 634 470 789 52 1427 1038 1176 222 380 845 1004 440 514 275 1092 797 899 471 550 78 222 331 1037 579 1331 1100 1223 934 1429 298 1212 522 1516 140 1333 592 1496 1185 1359 222 1325 616 1172 14 407 812 1437 17 222 50 81 43 679 563 1194 195 1496 775 1430 59 917 928 1371 29 454 201 1480 849 1133 155 1014 545 969 1146 1347 675 681 170 1380 824 1121 129 1252 831 1008 804 1305 400 947 643 1500 143 739 754 1239 511 1101 393 732 156 1136 168 1052 786 1515 495 716 73 126 610 1342 527 928 1092 1306 1073 1354 920 1022 32 1408 33 1137 1096 1331 130 1034 795 805 19 436 293 776 259 1187 194 470 849 128…
Output: NO

Constraints:

1 <= n <= 2873; 0 <= m <= 5746; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
The Two Guilds of the Solar tunnels - MEDIUM Coding Problem | CodeTikki