CT51495

Elowen's Two Guilds Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

In the tundra station of Whitesnow, Elowen the measurer keeps careful count of the roads. Catalog the new acquisitions, every figure matters. 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 <= 1116; 0 <= m <= 2232; self-edges make the answer NO.

Example 1:

Input: 982 418 1 2 2 3 1 3 58 726 571 832 141 186 407 564 179 718 403 718 244 851 332 666 555 590 569 668 523 907 627 823 555 839 87 90 631 831 170 442 55 946 654 695 957 978 246 807 744 956 304 910 536 619 169 224 70 976 762 934 25 560 590 645 401 456 494 658 366 408 406 964 359 361 187 373 34 194 541 657 58 317 42 600 453 841 211 871 697 767 623 712 345 383 386 812 385 864 75 113 26 91 561 790 13 131 221 334 106 948 499 591 1 279 137 244 522 968 167 561 267 368 86 577 415 723 32 460 95 626 438 954 592 826 177 331 47 899 56 523 434 914 6 287 40 861 372 402 376 784 87 322 592 707 263 748 469 663 423 428 123 349 36 582 215 547 425 667 66 856 806 921 350 470 482 698 402 736 321 374 163 350 9 345 456 692 411 822 586 868 50 419 498 958 791 830 676 945 146 809 305 491 48 734 144 490 244 567 141 773 24…
Output: NO

Example 2:

Input: 347 1564 241 308 175 343 12 277 167 292 104 213 135 260 94 319 31 313 158 175 109 147 199 266 87 212 54 253 227 347 230 260 116 331 156 254 28 40 47 172 90 264 15 92 35 92 74 158 122 261 164 299 152 158 165 277 146 263 28 345 316 326 187 282 212 243 217 277 110 200 19 279 1 340 85 128 275 284 158 339 280 328 89 184 27 118 22 74 296 310 29 221 32 152 170 314 221 330 55 291 25 262 189 208 46 162 224 289 80 221 163 234 165 303 16 324 21 67 172 270 98 108 230 233 94 297 188 279 195 199 117 148 264 298 124 125 94 248 226 285 66 72 100 224 68 283 12 219 260 320 106 254 41 97 247 312 252 281 32 182 141 317 44 77 6 68 210 212 156 335 207 225 130 181 326 331 297 328 222 283 56 230 184 261 182 309 301 327 102 235 165 176 17 33 302 314 84 309 289 299 179 244 243 264 31 34 235 298 233 275 15 231 139 3…
Output: NO

Example 3:

Input: 617 733 43 95 362 558 47 74 27 265 425 612 249 294 344 544 34 284 192 333 277 499 104 433 70 443 54 161 227 590 12 502 293 306 311 328 276 557 360 571 216 337 106 517 30 224 397 551 116 349 135 562 316 438 326 533 333 541 79 570 6 504 96 301 279 405 124 158 78 418 3 172 200 334 262 438 252 326 129 132 471 567 23 519 241 323 141 605 70 272 4 466 9 34 71 158 502 563 318 474 54 135 156 538 385 569 175 533 548 570 80 190 54 516 371 530 171 293 56 172 390 571 98 192 193 462 422 616 244 388 218 478 520 554 169 278 46 343 356 399 150 328 162 167 10 508 67 302 45 471 269 578 421 603 325 460 272 378 173 212 400 587 461 482 196 413 131 212 215 339 278 392 179 366 146 517 123 554 113 355 494 551 2 585 58 94 21 523 221 506 156 461 88 391 104 567 521 555 230 570 238 542 232 383 170 608 435 597 10 268 4…
Output: NO

Constraints:

1 <= n <= 1116; 0 <= m <= 2232; self-edges make the answer NO.

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