CT64335

Innkeeper's canals Two Guilds

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Every season at the ink district of Scriptoria, someone must assign crews to the morning shifts. This year the task falls to Innkeeper, armed only with the canals register. 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 <= 895; 0 <= m <= 1790; self-edges make the answer NO.

Example 1:

Input: 394 1171 1 2 2 3 1 3 106 247 106 310 68 340 65 162 168 294 33 288 64 355 28 355 163 241 211 322 184 234 56 360 68 335 21 22 133 270 93 265 250 264 88 233 55 303 203 271 319 390 106 256 16 225 22 375 322 378 174 370 204 287 102 136 130 204 8 202 28 164 113 127 55 146 130 254 13 145 94 234 238 332 174 244 54 217 102 318 108 374 85 289 74 347 52 120 20 272 139 250 165 365 168 350 276 337 286 364 114 239 256 377 69 164 253 306 307 381 68 185 190 301 107 289 146 380 82 201 128 208 123 347 300 308 166 374 156 298 162 328 41 75 40 308 127 216 42 390 91 350 165 285 74 92 87 99 40 93 46 220 42 45 23 392 117 201 83 345 33 90 60 202 51 132 198 314 86 357 361 386 35 311 148 350 260 384 72 223 229 267 274 377 104 352 45 49 172 385 76 364 137 288 154 353 69 303 70 172 280 365 90 221 217 307 63 338 42 28…
Output: NO

Example 2:

Input: 652 971 333 453 23 424 49 398 68 631 16 287 29 489 428 491 52 562 58 628 285 308 402 585 249 352 294 336 354 415 145 172 66 614 27 66 115 571 43 127 68 329 211 335 611 630 32 504 46 444 397 427 569 595 66 396 127 549 66 562 287 636 181 570 245 429 42 67 253 255 87 115 26 498 184 417 52 328 167 445 169 239 349 631 121 334 38 361 59 530 19 291 194 553 425 612 345 381 196 355 313 500 416 453 163 563 432 632 244 594 57 294 175 275 364 466 504 647 147 309 106 572 334 532 301 556 433 644 160 558 360 528 285 317 249 378 277 532 327 579 533 633 64 302 176 272 360 393 73 397 287 457 218 541 451 589 190 243 368 441 370 416 101 481 257 561 306 319 100 373 475 613 5 377 354 611 84 397 190 621 7 441 200 286 267 551 113 170 98 199 81 344 263 542 327 587 313 364 126 210 308 516 384 630 437 636 164 399 54…
Output: NO

Example 3:

Input: 891 1071 1 2 2 3 1 3 753 780 207 347 619 779 362 734 129 305 27 275 329 463 632 663 29 123 36 79 43 255 292 395 344 543 83 445 585 856 10 80 548 680 270 288 645 837 250 280 491 722 79 693 507 681 78 619 589 614 130 200 281 463 201 597 453 862 69 240 168 780 229 721 115 236 494 503 429 826 477 724 440 492 454 843 466 648 24 459 582 854 697 807 334 371 305 609 120 385 164 414 164 342 14 92 66 487 179 465 573 621 145 742 538 680 260 551 366 367 478 760 353 485 297 707 412 602 495 683 4 34 180 467 314 682 537 683 691 703 621 763 335 443 128 379 316 819 233 841 467 652 809 857 69 442 159 351 178 351 251 826 735 766 307 379 478 623 332 804 268 635 451 754 152 565 246 612 419 494 344 533 259 550 346 760 25 514 9 878 37 407 511 555 370 388 53 132 401 856 207 221 468 728 123 594 129 172 737 875 180…
Output: NO

Constraints:

1 <= n <= 895; 0 <= m <= 1790; self-edges make the answer NO.

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