CT47855

Gautam Counts the bridges

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The council of the marble forum of Argentium pays by the answer, and Gautam intends to earn it. First: the full register of bridges. 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 <= 1837; 0 <= m <= 3674; self-edges make the answer NO.

Example 1:

Input: 1142 1059 1 2 2 3 1 3 100 582 14 983 228 810 635 671 416 871 46 660 504 654 1014 1142 326 779 381 1050 338 884 87 921 904 1095 279 759 404 629 186 1137 731 957 302 733 479 902 153 552 129 765 135 362 433 1110 64 182 40 573 206 870 859 907 200 888 169 284 9 310 24 391 214 504 913 1073 419 1105 202 903 99 370 158 1072 291 956 266 416 25 649 42 271 65 146 381 984 911 948 935 997 472 710 105 684 180 380 490 946 749 946 882 1041 908 1027 779 928 160 431 542 983 38 908 420 755 294 1105 171 281 922 1074 340 540 569 953 190 791 155 168 353 627 924 1116 73 957 59 494 616 1125 815 1110 810 952 206 1092 386 921 169 388 482 934 55 610 267 487 119 939 149 1064 431 878 670 1112 837 920 363 1011 137 575 395 822 299 806 160 801 735 752 108 1003 707 845 338 612 170 1075 162 907 416 606 440 1038 458 723 172…
Output: NO

Example 2:

Input: 954 3632 142 875 296 810 577 599 603 703 616 886 106 434 668 722 866 885 160 683 37 730 430 620 664 906 224 287 144 786 512 623 657 754 870 907 117 331 739 773 415 616 295 612 218 329 336 713 580 823 487 703 41 654 79 843 198 532 253 523 471 575 253 408 35 39 234 839 72 253 14 666 278 405 88 819 328 868 305 820 231 598 495 527 279 817 135 787 334 675 96 682 204 796 925 951 790 813 709 832 316 834 136 335 377 762 245 752 331 542 614 941 164 349 283 749 147 754 752 870 213 860 69 415 904 908 166 679 201 440 198 635 23 637 521 539 398 836 12 808 624 948 534 884 481 508 49 659 89 552 871 881 111 281 257 849 285 497 198 212 46 892 612 670 445 860 231 807 48 871 99 246 439 918 377 930 232 809 309 321 57 248 624 755 27 722 327 922 857 949 67 113 581 927 187 670 100 528 209 420 750 933 53 902 243 …
Output: NO

Example 3:

Input: 1760 520 1 2 2 3 1 3 1002 1609 420 1413 556 1206 466 1623 362 417 490 1364 956 1463 1301 1628 872 1501 236 1470 435 1513 703 733 103 1026 3 832 790 1545 793 1365 354 904 597 1309 554 1158 671 1759 821 1449 1344 1613 1020 1226 94 755 405 1599 1594 1719 583 1712 969 1236 798 1081 635 807 702 963 1168 1223 119 1345 951 1529 72 1610 553 1226 263 1540 576 1119 1539 1709 277 1451 45 1156 255 651 304 394 1004 1346 1327 1577 809 1267 700 804 1447 1500 272 1099 867 933 554 917 1223 1258 141 471 399 401 118 1486 213 1489 1111 1295 416 1419 1006 1232 773 972 324 1557 956 972 93 1689 140 1305 711 1349 413 1223 523 1336 1466 1519 600 1555 551 983 1377 1476 400 575 267 1038 1014 1714 617 1287 1372 1621 341 729 1539 1643 1318 1705 161 719 1488 1726 1468 1507 611 1406 834 942 1445 1748 873 1454 573 719 67…
Output: NO

Constraints:

1 <= n <= 1837; 0 <= m <= 3674; self-edges make the answer NO.

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