CT48768

The Two Guilds at Goldmeadow

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The valuer Uma has been asked to secure the caravan contract. On the desk lies a long table of tunnels readings. 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 <= 2123; 0 <= m <= 4246; self-edges make the answer NO.

Example 1:

Input: 962 1275 1 2 2 3 1 3 515 851 114 229 446 844 609 644 126 336 346 793 190 655 218 737 133 678 286 675 137 632 751 774 179 214 822 840 292 357 623 933 586 846 147 797 511 541 164 721 213 461 485 955 50 850 142 572 222 505 189 404 305 763 293 673 14 754 251 638 27 112 25 651 592 691 137 703 317 580 49 159 17 235 2 775 154 745 216 953 820 882 687 831 215 433 557 580 398 798 84 649 12 600 289 732 472 792 146 369 2 225 769 770 747 805 589 808 199 306 328 695 168 726 861 872 499 653 292 410 278 341 334 530 125 155 85 462 186 758 407 656 112 565 84 267 149 949 304 917 418 626 477 558 467 805 112 350 283 791 97 125 43 187 77 114 215 463 72 469 566 698 890 922 703 742 51 929 434 757 23 894 94 362 225 906 61 248 212 234 151 562 664 898 64 376 337 667 225 804 358 960 428 608 72 744 226 866 244 556 3 5…
Output: NO

Example 2:

Input: 1647 2578 1 2 2 3 1 3 65 924 930 937 940 1355 30 386 99 449 572 1066 1129 1577 1150 1252 860 1316 297 1467 111 1647 331 1291 500 1005 192 675 71 927 267 1521 884 907 205 788 252 641 1244 1599 719 1029 1144 1557 294 471 600 675 1386 1603 447 624 1039 1107 126 1264 573 1559 58 904 502 513 389 976 1136 1488 349 1527 1345 1449 584 1122 122 1061 257 1329 157 1484 698 1323 575 1220 847 1414 291 320 571 977 428 1475 5 931 327 753 392 1301 600 1344 726 1253 484 784 733 778 92 1140 490 1467 842 1594 197 1431 1167 1483 48 1439 728 1273 358 1627 194 1038 663 1460 524 809 1340 1644 1115 1213 358 379 471 809 576 1147 375 451 568 1375 390 710 428 560 968 1583 319 771 449 600 175 1348 747 1551 109 220 602 635 481 1473 28 246 791 1471 146 502 280 1386 1527 1543 686 1421 389 547 262 782 1407 1540 154 857 1…
Output: NO

Example 3:

Input: 1575 4160 192 1125 1003 1374 28 1488 665 1393 1282 1377 576 1464 132 175 111 685 1381 1448 280 1154 391 1451 514 859 1308 1487 1384 1506 413 485 563 750 931 1524 573 855 1308 1344 283 1219 546 677 1108 1381 1126 1416 1017 1570 711 1156 217 1366 129 1546 485 1144 708 1342 462 818 749 1258 100 431 539 1451 88 499 182 499 638 1021 1073 1166 533 744 730 1223 343 706 699 1337 971 1144 439 1293 181 799 21 231 735 950 311 389 649 863 114 880 400 555 752 1529 246 855 1179 1266 339 1211 926 1568 194 1448 174 879 835 1355 26 468 532 588 384 1524 547 1380 73 799 87 250 83 1480 934 1510 333 1099 476 508 406 840 33 1345 17 947 1029 1146 1114 1392 609 1489 159 1528 378 1491 1255 1458 507 810 365 1176 1156 1232 284 1044 691 1070 503 553 524 570 834 888 854 1435 264 1068 62 876 1418 1499 962 1358 363 583 …
Output: NO

Constraints:

1 <= n <= 2123; 0 <= m <= 4246; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
The Two Guilds at Goldmeadow - MEDIUM Coding Problem | CodeTikki