CT36178

The Topaz tunnels of Fletcher

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

It is audit day at the northern keep of Frostgate. Fletcher spreads the tunnels records across the table and picks up a sharp pencil. 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 <= 2002; 0 <= m <= 4004; self-edges make the answer NO.

Example 1:

Input: 335 866 217 221 147 214 96 248 12 54 74 314 154 294 154 276 126 317 13 195 95 297 27 99 106 222 193 331 265 303 118 268 39 194 71 147 193 250 198 231 33 246 136 299 168 219 130 150 108 217 232 317 128 247 22 141 93 142 113 177 178 297 122 219 33 51 25 276 18 210 290 318 194 271 76 223 245 316 234 257 149 311 139 292 37 97 40 171 3 211 156 275 1 213 115 124 99 106 104 167 250 314 286 312 70 314 1 311 49 169 94 272 169 203 82 287 2 110 189 303 182 291 288 326 157 203 1 235 105 250 39 52 30 276 166 186 235 335 95 136 141 178 26 200 37 251 215 245 267 323 81 140 308 330 42 214 96 254 24 285 43 271 1 328 209 238 20 29 114 301 194 326 61 247 104 127 1 196 276 323 164 243 155 206 260 328 175 198 22 43 21 245 89 262 241 302 100 325 201 307 88 182 125 322 28 171 69 312 206 257 186 228 91 203 202 28…
Output: NO

Example 2:

Input: 1484 1909 98 110 560 1394 815 1149 1294 1391 828 1377 357 1183 692 1092 150 263 390 762 943 1270 189 631 80 1330 195 700 328 624 478 554 466 786 989 1327 981 1310 563 938 307 1375 324 353 1403 1439 248 768 1098 1194 181 425 199 1345 298 1116 113 1403 1138 1251 492 1416 50 1302 1305 1475 1210 1450 202 1070 922 1377 1074 1384 136 1210 56 477 209 985 597 1066 645 1091 140 695 639 1481 372 750 319 567 788 951 183 275 100 1472 401 1057 533 679 1102 1195 1037 1108 605 1099 395 568 467 720 658 773 1060 1445 852 1172 261 400 490 954 590 711 408 606 958 1468 212 722 290 920 412 989 273 1339 411 1161 205 1178 856 1262 799 1119 1340 1346 260 524 895 917 422 1053 877 1460 163 882 54 443 789 1324 215 1161 1261 1304 401 751 389 582 623 945 649 879 350 1383 401 604 120 474 194 575 831 1460 99 350 303 118…
Output: NO

Example 3:

Input: 379 3171 172 182 20 126 78 92 40 172 214 278 229 289 209 312 347 356 72 351 125 173 218 266 112 156 38 125 205 329 95 285 34 198 254 336 15 242 30 74 138 274 57 91 63 122 221 262 2 165 107 299 300 348 167 195 61 211 232 282 32 346 202 366 341 365 137 174 89 340 143 326 348 371 54 203 12 185 156 276 283 312 38 330 21 37 1 80 96 141 22 66 272 320 44 47 264 327 273 302 134 156 139 200 30 132 53 377 80 192 117 297 226 378 321 328 292 338 31 197 150 196 253 371 35 95 119 217 90 119 186 277 201 375 187 242 101 205 259 363 130 367 82 148 171 327 61 130 26 110 21 324 35 88 10 219 57 195 2 374 14 241 208 355 30 353 29 161 50 177 16 139 131 162 144 361 181 339 4 216 292 375 165 190 95 261 242 343 94 95 98 103 247 322 15 317 24 77 65 237 135 352 34 69 47 52 112 230 115 366 242 358 222 261 332 361 82 …
Output: NO

Constraints:

1 <= n <= 2002; 0 <= m <= 4004; self-edges make the answer NO.

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