CT58875

The Two Guilds at Balmcrest

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

In the cedar groves of Balmcrest, Fiora the registry keeper keeps careful count of the canals. Decode the foreman's shorthand notes, every figure matters. 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 <= 1725; 0 <= m <= 3450; self-edges make the answer NO.

Example 1:

Input: 605 2616 227 301 40 385 378 518 24 525 284 547 480 521 103 372 364 553 195 384 332 542 502 538 147 588 136 169 137 174 69 308 226 430 194 416 121 475 373 540 2 262 166 453 91 345 122 207 72 103 102 419 407 534 208 587 2 495 128 419 85 591 41 165 425 551 188 425 187 388 62 568 256 468 35 285 77 293 311 420 533 583 48 209 104 244 243 266 467 502 410 530 117 353 50 299 17 363 43 199 389 559 155 396 127 185 451 479 76 199 244 266 244 271 4 196 129 165 46 414 217 339 275 346 241 520 181 230 96 386 249 483 258 596 438 502 212 221 80 415 55 364 5 301 177 444 50 557 70 205 334 524 287 332 197 371 53 193 210 572 393 518 227 594 74 464 58 521 205 431 97 467 409 578 116 336 149 267 350 440 364 405 215 451 184 452 317 518 8 193 72 454 97 469 46 252 60 174 280 372 361 499 156 264 16 582 155 433 527 570…
Output: NO

Example 2:

Input: 668 2795 1 2 2 3 1 3 253 559 256 616 21 523 311 659 13 504 201 516 30 348 132 336 211 330 140 533 418 668 512 527 350 648 28 332 260 357 119 423 259 571 84 266 218 519 236 349 231 566 256 309 51 366 39 211 72 456 64 105 35 470 536 582 194 604 105 188 517 571 94 325 169 215 529 627 242 491 134 546 79 576 272 283 278 593 15 248 176 238 107 186 188 252 17 170 340 621 282 366 372 554 230 667 521 601 181 259 119 303 46 334 210 424 140 589 9 177 149 236 241 654 408 534 203 241 108 560 352 516 177 332 533 558 225 468 358 369 309 427 81 582 45 237 520 540 55 516 105 336 67 201 302 332 285 396 12 349 32 441 11 328 213 501 2 464 70 513 382 396 142 257 65 428 307 535 305 639 317 646 486 609 74 590 52 238 416 595 207 251 111 382 492 554 227 379 254 392 277 324 433 454 237 442 149 186 247 321 68 445 4 …
Output: NO

Example 3:

Input: 687 2338 321 646 153 383 556 669 146 371 193 498 8 449 549 572 153 286 455 684 204 302 83 338 327 626 327 468 94 392 93 662 524 529 97 352 327 494 23 265 455 574 597 632 518 606 478 570 255 389 311 524 505 549 336 659 34 396 142 653 414 544 154 157 85 378 244 432 30 55 116 540 90 567 324 423 216 371 339 654 611 621 3 533 275 682 1 400 336 438 391 426 308 383 503 511 345 663 391 662 547 581 313 479 20 665 326 568 182 466 98 540 157 648 173 321 226 469 126 526 283 624 2 318 23 657 145 565 171 564 170 227 103 381 257 507 37 599 504 616 587 615 7 473 295 662 5 144 22 377 242 270 604 683 199 638 6 139 289 452 176 502 312 331 256 395 10 26 287 375 225 535 332 455 574 611 87 269 68 605 27 674 77 238 355 601 78 148 142 476 243 512 183 279 19 143 8 208 549 652 93 429 1 423 66 434 135 246 290 599 20…
Output: NO

Constraints:

1 <= n <= 1725; 0 <= m <= 3450; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
The Two Guilds at Balmcrest - MEDIUM Coding Problem | CodeTikki