CT41281

Clerk's Two Guilds Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The harbor bell rings at the fen lights of Will-o-Wisp; Clerk weighs the day's bridges manifests and starts the calculations. 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 <= 2136; 0 <= m <= 4272; self-edges make the answer NO.

Example 1:

Input: 717 4226 288 544 281 607 49 470 341 562 347 695 532 652 269 294 149 337 35 519 310 692 271 575 313 344 528 577 253 548 50 223 247 464 251 525 119 299 441 543 140 655 525 584 96 693 51 66 106 384 336 366 216 594 120 691 264 277 84 310 226 309 268 455 182 492 37 544 413 461 201 402 327 459 111 255 563 579 271 641 134 370 253 562 319 497 382 690 48 500 83 422 78 349 461 661 427 594 211 220 302 646 146 331 470 612 104 121 101 623 40 418 298 366 483 699 404 554 577 694 211 651 160 657 358 449 40 201 246 263 408 649 115 174 236 560 197 610 425 607 126 663 484 658 180 207 236 271 402 626 391 460 75 313 163 534 294 577 92 217 208 499 325 505 178 275 294 432 635 707 260 426 381 506 77 550 195 573 325 652 82 715 504 576 164 494 76 589 197 622 107 404 127 498 95 139 69 246 503 637 399 529 208 325 242…
Output: NO

Example 2:

Input: 1625 890 1 2 2 3 1 3 320 906 703 1498 16 1165 1384 1416 503 1276 177 1581 1137 1150 706 1541 795 1428 9 1309 992 1264 1182 1215 1085 1197 475 1462 960 1333 770 1528 587 894 1050 1302 375 534 973 1020 644 878 779 830 378 1373 510 1087 879 1381 156 276 986 1028 335 1379 274 574 233 677 98 1148 98 1024 386 1571 394 1230 39 937 442 1483 641 791 531 634 101 129 350 635 205 236 308 557 632 1316 617 830 386 1584 119 1296 282 962 124 323 622 1046 829 1268 611 1347 776 1186 386 1566 1454 1585 16 1524 1165 1507 137 574 881 1480 223 262 1107 1527 325 701 359 619 38 714 557 868 773 1343 505 543 112 1037 43 1108 942 1028 173 655 196 591 1135 1140 186 391 275 872 1037 1476 481 488 39 981 1025 1153 530 1030 893 1365 1334 1586 221 947 1367 1595 535 1273 647 830 667 1461 1078 1129 119 618 446 706 95 739 22…
Output: NO

Example 3:

Input: 875 3943 1 2 2 3 1 3 36 253 23 165 97 832 75 508 258 665 53 190 396 715 273 470 498 848 7 168 667 872 72 423 224 293 767 861 424 826 367 706 41 429 682 721 206 700 545 644 373 615 304 472 25 334 43 264 122 765 441 477 172 378 275 514 824 855 126 652 71 525 355 590 232 620 51 266 458 775 495 819 31 847 413 569 83 521 82 359 137 826 523 822 471 500 171 376 195 724 764 806 416 474 595 750 102 237 65 567 552 638 759 849 73 486 500 524 5 845 84 512 409 859 114 513 575 796 268 667 294 397 405 685 807 857 477 815 685 691 603 641 330 737 115 173 539 836 498 632 482 746 607 715 606 660 105 755 385 687 241 449 51 231 439 782 363 830 299 739 276 416 402 406 490 805 63 557 230 774 20 230 215 268 124 808 131 401 48 680 505 788 640 753 229 379 605 680 797 817 89 379 281 451 242 534 507 524 503 838 40 21…
Output: NO

Constraints:

1 <= n <= 2136; 0 <= m <= 4272; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
Clerk's Two Guilds Ledger - MEDIUM Coding Problem | CodeTikki