CT42113

The Stonehallow Two Guilds

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Caravans arrive at the granite steps of Stonehallow with crates of routes, and Bhavi the reckoner must account for every last one. 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 <= 1333; 0 <= m <= 2666; self-edges make the answer NO.

Example 1:

Input: 119 2397 30 115 43 51 20 109 105 114 4 66 23 102 33 75 1 50 41 107 13 54 32 118 44 87 35 78 43 45 5 54 43 57 50 73 19 38 32 69 98 104 48 113 37 52 50 103 56 96 37 53 60 71 33 102 66 113 87 102 63 73 43 104 42 92 10 45 28 38 1 31 6 84 11 73 16 40 1 12 12 65 17 24 68 117 49 74 34 77 40 115 19 100 2 53 17 47 43 52 19 79 20 66 53 104 69 103 54 111 63 77 55 110 16 100 52 89 45 104 31 59 110 115 1 24 35 82 33 87 66 106 10 30 7 8 15 19 5 40 43 69 37 112 81 100 52 106 64 118 24 102 22 97 6 27 27 43 29 32 58 64 24 46 1 75 48 70 9 31 80 103 52 64 102 113 15 102 35 39 9 44 84 118 3 76 65 67 77 114 29 112 25 63 60 84 70 94 12 13 12 116 17 62 5 81 4 28 22 114 10 11 12 94 62 112 46 101 43 77 77 106 56 118 45 110 42 50 53 62 79 106 54 71 17 18 96 101 7 9 16 103 40 107 46 67 79 118 93 119 38 55 60 90 66 1…
Output: NO

Example 2:

Input: 239 1441 117 188 200 225 148 184 56 117 29 179 6 45 74 164 23 195 105 232 111 151 112 222 90 197 14 69 142 201 102 150 21 185 67 84 13 70 229 239 124 235 7 52 214 226 189 239 45 143 39 146 83 198 58 218 78 103 127 145 195 208 118 162 185 187 136 166 69 215 92 171 34 145 119 160 59 147 37 106 145 155 70 77 116 191 19 152 83 100 43 120 32 112 47 151 116 127 92 164 32 131 55 205 37 146 4 120 202 213 11 125 150 171 80 206 43 151 104 230 116 221 45 70 25 233 89 239 98 218 176 210 68 174 36 133 8 91 25 83 39 153 23 127 15 176 20 27 207 209 17 146 196 200 181 212 34 37 136 146 88 210 137 192 16 167 13 19 11 239 217 236 15 100 95 97 106 184 161 170 139 175 27 137 108 173 225 235 106 231 33 43 99 116 105 208 199 233 42 129 176 184 117 153 53 130 36 52 26 159 27 126 167 171 32 147 58 237 14 198 25 1…
Output: NO

Example 3:

Input: 239 1327 30 116 49 216 22 190 19 189 35 174 10 65 39 126 77 223 43 114 93 219 112 171 20 82 46 209 189 214 85 106 60 65 14 54 2 77 175 192 182 186 103 185 120 137 61 204 118 119 110 197 21 199 16 186 8 234 89 96 167 174 32 148 99 113 53 236 195 239 11 77 67 138 168 226 112 125 25 27 37 185 186 228 62 178 29 221 36 48 59 90 31 48 92 171 26 185 199 226 25 233 122 177 112 137 106 180 5 183 34 163 27 195 44 119 131 188 9 164 28 149 39 239 134 146 51 217 11 160 141 231 65 193 40 111 103 237 152 239 48 72 13 235 15 127 2 161 144 216 23 138 25 227 52 98 94 162 62 229 74 184 38 102 197 222 190 219 55 149 102 206 58 131 124 236 39 190 8 9 128 197 92 173 29 89 62 133 113 216 44 166 5 217 38 81 93 226 62 203 111 192 9 43 72 223 23 172 140 146 5 170 50 163 9 174 35 68 23 207 5 212 209 212 25 184 27 14…
Output: NO

Constraints:

1 <= n <= 1333; 0 <= m <= 2666; self-edges make the answer NO.

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