CT62646

Finn's bridges Two Guilds

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Finn the cartographer watches over the orchard lands of Applerun's stores of bridges. A careful computation stands between order and chaos. 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 <= 1301; 0 <= m <= 2602; self-edges make the answer NO.

Example 1:

Input: 1296 1841 807 812 431 1058 844 965 192 762 561 684 975 1121 167 1037 345 440 103 1003 1089 1282 348 1295 176 1249 200 1265 184 485 352 875 308 1289 464 985 137 1070 307 607 552 868 457 986 880 1287 305 981 309 859 208 670 941 981 764 1289 403 1232 396 1264 669 1108 11 512 330 350 373 1095 166 217 119 730 329 1170 191 647 919 1041 112 982 167 1170 159 1096 652 1084 254 500 391 1173 651 926 600 1240 235 526 1268 1295 844 860 457 1187 865 1199 4 981 404 537 560 775 968 1088 141 677 803 1163 386 680 902 1167 288 1061 84 1043 674 1167 369 929 131 393 435 821 330 679 513 663 400 688 7 853 167 199 302 1242 275 1244 218 341 533 1006 969 1231 370 633 378 1256 67 239 410 1132 909 985 376 929 837 1273 11 1144 817 1265 209 902 284 736 468 996 97 395 965 1296 521 1015 77 791 55 348 534 1267 31 73 911 1…
Output: NO

Example 2:

Input: 674 1720 544 673 50 414 327 553 133 642 144 507 75 225 436 664 86 269 467 641 363 539 147 377 327 468 319 493 81 407 189 514 60 103 125 632 437 490 262 350 43 234 401 496 337 414 188 223 150 590 518 631 43 102 369 637 250 631 178 591 23 515 379 429 506 592 32 647 357 492 440 458 247 630 13 330 277 321 327 371 98 346 135 200 59 239 270 600 206 385 188 510 206 410 282 380 94 152 413 566 112 462 55 597 361 432 156 533 526 568 169 489 620 650 60 619 434 567 529 623 277 502 313 321 443 462 25 238 146 603 196 435 401 636 318 549 49 429 366 378 121 439 19 76 539 596 436 455 519 540 13 465 109 287 91 456 32 587 39 251 157 211 69 359 189 608 441 650 24 289 450 505 245 380 145 169 628 651 344 440 54 73 276 616 366 528 273 402 215 374 224 673 47 263 119 181 281 383 270 370 536 610 153 353 30 604 534 …
Output: NO

Example 3:

Input: 703 2204 1 2 2 3 1 3 565 588 453 684 78 474 129 181 126 687 428 544 13 447 157 390 226 296 277 509 185 196 277 635 56 156 454 648 279 661 72 242 71 647 18 415 267 589 441 608 201 466 258 657 300 348 37 485 164 310 141 434 72 241 403 690 25 212 240 455 4 578 319 703 138 548 434 565 180 181 308 485 217 655 335 641 96 484 111 225 89 237 297 429 247 571 16 590 214 331 216 635 437 632 70 655 81 630 306 655 457 510 95 278 577 637 571 626 310 544 579 669 86 102 658 659 79 194 105 501 35 563 304 575 19 315 229 660 150 476 72 509 446 681 17 426 388 535 5 484 480 641 215 234 144 493 79 502 283 561 541 644 384 683 231 403 429 644 370 383 190 690 319 588 253 623 368 481 612 695 47 138 21 52 313 586 507 581 92 347 240 649 130 541 568 665 356 490 264 412 389 429 9 691 242 307 471 487 459 516 327 404 106…
Output: NO

Constraints:

1 <= n <= 1301; 0 <= m <= 2602; self-edges make the answer NO.

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