CT62811

The Saffron tunnels of Dora

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

The council of the quartz ridge of Glimmerfell pays by the answer, and Dora intends to earn it. First: the full register of tunnels. 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 <= 1856; 0 <= m <= 3712; self-edges make the answer NO.

Example 1:

Input: 1267 3513 1 2 2 3 1 3 99 835 120 384 91 397 166 486 348 538 376 576 245 588 104 627 98 161 9 535 357 987 1100 1148 530 727 33 685 301 659 70 231 304 1081 607 808 1 79 308 777 449 1103 68 695 909 1143 403 420 320 561 296 948 260 846 103 938 602 865 746 870 864 966 444 1154 113 128 558 841 148 1090 222 230 487 1078 110 877 90 1249 108 181 871 1085 81 896 140 940 23 864 819 940 635 1088 298 854 86 983 545 910 837 977 596 1086 220 961 229 866 131 785 132 224 137 1168 35 606 879 1154 584 1214 29 887 126 1105 157 188 1048 1073 127 405 462 1149 136 1188 144 835 56 275 32 330 933 1108 72 374 249 565 691 1188 181 468 173 975 452 1213 453 1169 337 592 241 1132 223 869 669 895 937 1112 322 898 362 728 267 1221 260 518 21 897 687 922 298 750 571 1188 22 684 165 827 275 1069 767 999 473 1082 851 1169 4…
Output: NO

Example 2:

Input: 62 1552 12 44 2 60 19 35 18 38 15 20 30 41 18 28 10 18 14 60 30 36 37 43 32 44 11 42 21 58 6 18 12 22 9 58 22 35 27 39 33 49 19 37 23 40 40 50 43 46 42 48 2 14 27 46 2 11 9 29 3 42 15 27 12 50 9 18 24 38 50 58 14 23 1 17 6 44 23 46 27 51 9 43 10 37 10 45 2 51 3 16 43 57 2 31 45 50 13 42 42 56 52 61 2 61 9 24 5 59 35 41 12 26 28 33 47 53 25 36 35 46 1 25 28 35 5 28 34 44 15 50 24 51 4 31 1 62 3 22 3 37 29 30 5 37 24 48 32 33 26 32 3 51 14 52 40 45 23 44 27 54 8 36 7 24 15 26 31 44 49 56 14 19 4 23 2 18 10 47 30 60 43 56 14 59 42 60 20 61 41 42 32 59 17 52 39 52 4 35 20 22 28 38 9 57 5 43 3 7 10 13 56 60 50 53 7 27 40 44 17 18 20 56 26 36 47 54 16 53 18 27 11 57 23 41 6 52 24 62 17 29 14 39 10 14 26 41 29 34 6 62 12 27 23 59 45 58 15 37 28 29 41 52 10 17 26 30 9 38 22 51 24 43 23 51 2 53 9 4…
Output: NO

Example 3:

Input: 1077 16 472 856 176 955 460 694 972 990 422 449 22 71 423 698 215 486 58 426 369 1015 53 281 223 327 57 77 416 476 320 825 122 457
Output: YES

Constraints:

1 <= n <= 1856; 0 <= m <= 3712; self-edges make the answer NO.

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