CT38318

Squire's tunnels Reckoning

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Squire the factor watches over the lantern reef of Glowtide's stores of tunnels. 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 <= 1172; 0 <= m <= 2344; self-edges make the answer NO.

Example 1:

Input: 696 1181 1 2 2 3 1 3 329 564 421 618 646 667 452 469 307 468 67 637 160 516 363 649 143 403 139 353 138 674 116 209 96 186 330 531 270 546 232 325 39 300 539 575 4 214 172 359 307 605 149 371 178 565 292 484 36 155 157 266 348 421 161 517 216 422 244 349 89 386 140 537 76 188 15 221 57 592 380 635 45 570 224 595 31 639 305 349 503 647 12 608 112 595 117 312 268 504 268 374 72 87 94 259 225 583 88 664 302 653 171 653 411 661 548 685 173 681 380 690 80 184 386 552 355 476 238 407 427 660 185 527 133 192 18 574 145 469 200 365 232 423 52 406 102 297 50 364 391 566 6 8 154 405 454 552 498 628 112 475 28 548 514 567 625 627 24 103 127 343 54 290 538 562 302 488 56 214 160 363 184 479 241 252 219 513 102 349 115 486 75 216 265 681 538 594 177 602 315 424 609 618 296 620 308 690 34 676 347 621 14…
Output: NO

Example 2:

Input: 821 187 581 816 615 688 494 664 101 712 534 541 114 267 245 512 225 618 370 532 99 328 127 773 261 529 166 455 70 357 142 232 425 746 226 291 554 814 493 543 386 772 434 641 288 558 82 363 201 500 15 655 35 202 88 496 331 705 8 728 613 813 239 544 279 534 11 819 131 377 159 765 400 773 319 518 143 483 14 72 471 663 478 761 213 404 513 679 585 712 175 746 16 244 61 509 607 622 375 659 113 268 362 404 741 808 562 654 206 298 432 598 522 624 46 227 7 188 389 622 337 784 6 439 336 436 325 627 242 663 320 679 345 810 6 176 244 587 291 785 168 415 41 789 614 635 398 771 50 234 389 480 367 420 255 643 207 219 154 562 17 254 731 738 393 804 624 666 50 128 509 709 233 640 118 213 112 419 284 620 146 164 637 719 619 639 86 818 323 466 577 667 105 474 38 275 286 733 52 459 215 298 513 774 515 704 154…
Output: YES

Example 3:

Input: 1139 2098 1 2 2 3 1 3 912 976 926 1091 20 228 621 858 859 1094 527 762 241 644 504 626 1011 1082 872 1032 887 922 673 1116 257 399 18 193 482 688 916 961 375 488 493 913 341 677 211 243 390 858 17 303 231 492 840 979 224 762 341 910 740 1076 762 790 154 552 368 835 110 845 79 243 150 1088 351 942 370 901 866 1007 176 674 457 495 572 809 756 867 99 256 80 402 83 978 515 1068 219 354 50 394 317 728 71 715 732 849 602 938 111 370 955 978 234 1060 37 233 171 786 76 135 207 703 74 1021 703 1038 535 746 732 880 822 992 139 245 107 1009 288 922 412 790 417 564 228 1009 226 668 406 577 61 181 618 669 430 893 225 1031 493 720 58 671 445 1078 109 597 678 787 273 288 738 960 799 813 796 1037 300 333 291 1077 323 1125 373 601 339 975 633 700 614 800 244 985 165 864 812 887 545 1072 1087 1119 653 759 1…
Output: NO

Constraints:

1 <= n <= 1172; 0 <= m <= 2344; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
Squire's tunnels Reckoning - MEDIUM Coding Problem | CodeTikki