CT63485

The Two Guilds of the Hidden bridges

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Before the gates of the rook towers of Chessfield close for winter, Aldo must finish the bridges ledger - one figure at a time. 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 <= 1127; 0 <= m <= 2254; self-edges make the answer NO.

Example 1:

Input: 642 1696 198 545 445 512 48 277 378 421 29 240 98 584 128 137 313 639 91 321 49 181 24 261 337 566 209 391 130 470 347 600 246 415 95 546 498 630 84 462 129 281 126 244 43 263 334 524 54 630 32 173 341 449 428 437 348 494 396 400 196 374 228 276 17 61 266 296 121 609 82 472 371 589 149 232 140 615 170 268 186 563 342 591 244 338 317 399 335 480 242 412 429 536 43 612 137 453 343 357 158 542 528 633 278 418 10 205 282 363 602 635 319 321 234 557 90 103 113 625 245 258 400 536 307 589 524 575 452 563 119 291 475 615 102 379 242 564 65 396 362 610 38 619 96 467 186 594 292 418 405 494 277 320 255 397 178 487 217 486 246 355 495 578 262 552 227 351 9 181 153 530 100 592 431 513 137 314 67 212 262 548 304 402 63 564 132 626 160 339 228 478 238 495 423 536 486 548 226 291 341 621 322 528 327 602…
Output: NO

Example 2:

Input: 377 940 1 2 2 3 1 3 342 376 59 339 1 265 109 238 215 319 158 367 137 316 37 38 11 322 80 275 24 87 157 219 184 199 138 288 69 239 65 150 150 296 77 114 2 51 100 171 66 172 85 194 300 304 70 290 177 278 89 342 89 201 30 308 49 91 51 128 185 370 99 325 242 280 258 329 231 323 36 242 58 107 163 331 177 343 261 268 7 64 68 324 106 313 242 352 154 291 269 372 248 299 100 337 322 354 97 239 257 368 41 251 32 360 44 295 72 274 138 140 51 117 195 251 50 274 81 229 83 110 162 345 13 365 319 320 210 327 197 317 184 332 143 165 14 296 87 339 96 218 80 135 64 240 10 136 41 223 304 354 87 290 141 260 65 348 143 225 190 286 183 276 18 143 55 301 85 135 70 244 80 162 123 188 53 219 166 303 122 196 292 351 164 291 314 337 26 116 180 278 81 350 249 288 153 224 117 257 46 197 64 285 201 327 124 191 12 270 2…
Output: NO

Example 3:

Input: 842 867 1 2 2 3 1 3 553 770 326 606 460 546 495 626 282 424 239 401 298 468 180 542 363 390 4 452 86 823 12 703 194 610 233 468 467 725 329 745 569 654 375 383 691 782 585 617 296 536 117 236 41 808 229 312 66 242 141 525 60 628 171 618 69 815 810 819 8 312 215 836 494 568 131 177 241 327 728 764 192 722 310 681 163 284 275 766 79 155 302 507 557 700 363 543 219 811 689 800 131 720 454 582 600 686 541 560 148 492 165 620 550 769 216 357 695 773 40 180 192 298 175 552 68 221 517 770 25 238 248 258 54 393 6 146 121 820 8 822 230 772 4 441 336 695 459 709 315 473 17 795 353 804 354 803 302 734 404 616 127 175 41 212 164 654 690 722 66 787 127 817 407 562 16 678 72 291 470 611 209 267 334 825 2 506 93 781 128 333 316 408 269 406 484 791 306 734 174 425 12 373 289 426 1 376 500 793 142 185 679 …
Output: NO

Constraints:

1 <= n <= 1127; 0 <= m <= 2254; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
The Two Guilds of the Hidden bridges - MEDIUM Coding Problem | CodeTikki