CT59722

The Two Guilds of Will-o-Wisp

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

The harbor bell rings at the fen lights of Will-o-Wisp; Corwin weighs the day's corridors 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 <= 2721; 0 <= m <= 5442; self-edges make the answer NO.

Example 1:

Input: 1248 967 545 617 458 476 644 1092 414 1168 349 1229 136 573 35 957 345 833 951 1228 320 1076 12 277 162 584 190 285 558 634 189 1004 33 963 949 1166 960 1114 371 588 25 814 26 1110 1080 1095 50 617 1003 1088 85 642 607 871 69 1150 260 1046 143 932 616 761 506 580 1113 1192 225 1007 326 652 617 1055 271 819 208 896 720 758 960 1010 756 801 608 1084 553 1053 129 893 172 196 91 638 13 295 264 1082 159 556 123 742 313 594 537 555 127 1108 259 1046 402 811 537 916 659 1090 260 825 166 418 331 1083 273 340 457 562 434 843 323 674 1070 1211 507 655 188 957 697 893 110 949 139 327 386 932 66 1070 553 695 371 788 713 1229 3 677 50 954 785 1132 69 388 121 1063 189 233 234 1225 827 877 1080 1101 117 504 153 332 120 553 292 994 311 335 133 744 547 1233 253 674 801 1005 748 809 209 388 30 481 550 777 6…
Output: NO

Example 2:

Input: 1065 3296 1 2 2 3 1 3 595 743 1 677 53 731 382 536 54 197 15 431 328 609 565 625 360 534 433 507 268 906 60 1007 151 875 83 124 627 706 61 950 49 519 309 486 969 973 886 954 233 850 897 996 406 708 398 964 218 1060 275 1033 739 1026 107 487 115 155 286 904 8 369 386 500 54 725 52 286 387 540 84 1027 434 875 341 740 333 916 288 759 359 1065 204 695 134 471 380 1028 186 707 294 380 461 568 229 446 157 884 303 937 162 629 781 844 54 86 788 965 160 232 448 1059 402 592 257 920 671 849 30 296 628 868 357 878 17 269 207 307 8 505 17 822 196 718 562 772 246 545 664 984 64 327 176 1057 350 761 28 801 119 478 929 998 63 630 391 652 205 757 57 675 956 973 131 941 425 836 589 1055 754 841 333 741 268 798 202 390 477 915 302 428 298 384 145 808 69 770 969 991 69 719 45 938 235 451 125 924 341 370 377 …
Output: NO

Example 3:

Input: 555 1287 59 109 1 235 198 227 81 338 64 227 335 407 110 323 282 309 190 228 111 353 372 418 137 506 305 364 373 410 261 411 116 224 262 441 37 252 217 554 108 341 266 479 191 474 18 317 232 398 176 375 85 346 240 420 412 515 349 452 44 131 86 485 158 357 59 309 210 483 255 512 132 412 340 496 130 169 352 397 323 416 334 382 86 180 148 334 71 514 363 548 276 504 126 322 74 299 45 447 112 301 197 361 245 401 102 303 6 132 334 340 195 276 138 264 136 209 16 301 306 523 275 326 341 422 119 252 446 472 192 238 68 87 129 323 71 480 310 444 177 337 189 252 229 551 132 484 355 505 157 433 268 430 318 329 84 166 63 81 110 137 168 262 29 531 405 450 426 531 187 335 418 555 276 453 255 550 228 419 377 523 79 473 282 367 214 428 42 513 185 218 196 371 28 549 107 193 76 491 163 239 43 257 52 90 381 484…
Output: NO

Constraints:

1 <= n <= 2721; 0 <= m <= 5442; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
The Two Guilds of Will-o-Wisp - MEDIUM Coding Problem | CodeTikki