CT57977

Chetan's tunnels Two Guilds

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Chetan runs the depot at the fen lights of Will-o-Wisp. Today the books show a list of tunnels, and the numbers must be worked out before sundown. 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 <= 1133; 0 <= m <= 2266; self-edges make the answer NO.

Example 1:

Input: 569 1649 210 212 135 368 162 549 332 376 424 558 300 464 94 108 270 336 204 234 165 256 167 471 93 524 154 422 62 187 483 491 73 114 157 160 423 482 444 514 250 556 124 561 127 412 365 409 228 331 309 556 483 550 299 548 188 366 240 449 457 545 134 255 328 552 112 343 257 331 314 399 195 385 64 261 246 534 84 313 448 528 214 385 76 208 303 514 230 334 95 160 20 329 488 548 447 503 56 321 1 193 244 505 54 331 189 385 32 456 251 500 3 452 34 319 332 522 39 91 154 505 385 519 179 550 298 519 204 401 147 336 315 522 14 48 168 268 26 208 36 422 206 556 202 267 423 513 141 568 323 354 416 499 244 294 185 228 442 539 144 172 267 481 144 391 34 559 157 529 167 521 85 140 59 126 49 140 276 441 32 280 87 568 61 201 39 215 150 321 214 453 24 241 12 209 310 403 385 494 95 313 255 264 1 113 129 568 44 …
Output: NO

Example 2:

Input: 434 1430 1 2 2 3 1 3 227 248 7 44 117 270 232 409 226 338 149 184 112 385 134 238 82 301 271 296 100 181 25 38 95 210 163 348 263 353 98 248 17 86 217 387 204 215 37 123 33 138 112 229 281 372 370 415 32 200 100 191 45 406 88 345 142 362 237 310 232 304 15 276 35 208 206 401 372 410 279 335 55 220 37 296 222 359 267 322 170 292 292 336 51 95 47 372 129 266 159 353 247 253 198 433 194 425 393 402 108 295 128 281 152 154 107 299 20 253 47 284 430 434 348 367 314 340 286 293 90 373 173 430 69 101 348 399 219 390 109 198 103 251 171 298 193 318 299 339 238 320 71 97 39 210 52 64 166 372 87 409 143 212 358 408 74 151 229 431 328 411 128 328 272 406 253 337 123 139 63 425 259 339 146 214 3 256 4 11 177 212 223 400 366 370 39 48 310 346 126 415 108 286 199 308 188 394 55 299 153 177 125 290 207 4…
Output: NO

Example 3:

Input: 985 1806 1 2 2 3 1 3 365 577 192 388 73 590 369 698 576 733 45 967 508 636 41 775 668 746 137 452 428 704 201 409 161 253 380 982 887 901 158 730 419 924 199 689 156 573 234 600 390 442 343 479 676 877 6 239 26 771 129 420 3 605 717 831 611 914 635 657 392 650 530 818 251 597 231 637 298 396 710 850 60 954 395 571 428 666 642 922 324 868 27 309 519 830 682 940 163 503 358 409 1 361 762 765 235 317 103 633 551 767 598 946 270 352 766 915 671 851 464 592 759 836 359 673 842 857 72 484 238 373 346 729 824 944 255 628 477 938 45 915 19 768 370 387 75 201 253 448 102 721 221 921 356 447 314 519 111 679 151 922 88 496 341 688 101 529 271 868 296 882 188 615 246 875 112 903 422 600 152 809 880 943 945 953 832 967 625 797 563 638 100 449 379 918 29 576 306 597 25 464 599 739 378 931 55 261 231 517…
Output: NO

Constraints:

1 <= n <= 1133; 0 <= m <= 2266; self-edges make the answer NO.

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