CT60917

The Two Guilds of Coralcove

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Vesper inherited the apiary at the island market of Coralcove along with its curious bookkeeping system for routes. Time to make sense of it. 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 <= 1687; 0 <= m <= 3374; self-edges make the answer NO.

Example 1:

Input: 760 660 62 465 497 732 1 355 284 681 85 310 79 360 371 641 287 666 55 506 686 695 321 542 556 685 9 409 525 665 109 431 100 509 247 274 105 674 305 314 694 703 59 516 723 747 204 549 616 738 419 605 155 397 164 197 123 673 118 211 205 379 326 640 167 391 713 757 27 456 380 581 281 327 488 717 447 713 443 625 47 498 604 755 94 424 555 732 70 335 114 359 261 431 20 740 238 285 51 546 363 401 117 277 81 739 672 703 707 753 343 656 159 625 231 351 252 262 333 402 707 740 359 392 577 651 9 557 231 593 487 638 521 745 40 375 123 395 497 659 384 719 457 616 214 443 91 709 454 632 243 642 474 508 62 602 94 541 258 458 400 686 447 657 29 667 327 643 106 215 225 670 408 564 96 519 171 291 92 194 428 442 51 61 216 587 45 103 63 566 38 550 313 420 295 419 475 520 334 506 488 586 43 105 20 539 316 737 …
Output: NO

Example 2:

Input: 1111 3358 1 2 2 3 1 3 123 231 157 548 446 564 951 1056 456 872 100 635 350 645 335 543 639 776 119 163 458 1075 386 814 227 544 40 580 92 653 583 688 521 955 765 878 914 1066 230 517 54 438 422 909 254 683 639 809 396 1066 337 1061 258 839 507 956 922 992 410 899 949 1063 281 711 61 742 214 1052 121 975 24 732 307 701 270 1012 508 828 334 946 752 844 640 935 487 1055 113 906 636 904 508 1056 55 449 261 807 404 590 578 667 56 873 249 841 300 913 4 73 286 1104 50 624 315 557 328 1078 466 1054 93 163 587 786 314 435 560 1054 490 632 67 190 204 874 943 984 49 1111 566 888 442 791 318 343 236 367 109 677 55 399 976 1081 423 727 547 566 12 576 29 552 4 786 681 852 370 925 12 1094 125 1100 709 1059 206 1023 860 1017 135 312 574 1082 987 1046 322 606 142 210 221 906 286 490 313 609 491 804 299 671…
Output: NO

Example 3:

Input: 530 3078 161 173 136 398 133 350 218 374 181 269 121 205 42 513 336 441 335 386 63 512 130 436 300 312 8 169 201 390 49 343 274 407 454 481 46 377 163 416 127 173 367 442 330 362 99 274 109 266 107 521 146 251 273 524 38 151 321 383 74 258 308 389 173 270 221 524 60 370 437 494 69 117 334 458 74 105 195 406 430 484 75 390 189 500 352 403 373 442 22 356 148 476 335 375 64 348 217 386 59 374 35 230 277 424 160 420 392 478 139 405 58 511 248 439 182 414 79 120 279 436 377 433 63 271 112 241 109 363 150 298 373 414 125 181 148 298 69 292 229 483 36 122 125 239 148 510 307 452 2 106 47 96 457 514 250 364 284 289 14 448 418 448 141 155 181 433 271 299 72 410 63 435 273 455 312 333 22 134 55 292 38 305 63 489 202 405 55 524 160 409 143 154 20 225 96 183 155 290 414 491 221 393 86 320 94 400 136 5…
Output: NO

Constraints:

1 <= n <= 1687; 0 <= m <= 3374; self-edges make the answer NO.

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