CT39621

The Pale tunnels of Kavya

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Morning light hits the willow walks of Reedmarsh as Kavya unrolls the day's manifest of tunnels. The tally will decide the next shipment. 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 <= 1371; 0 <= m <= 2742; self-edges make the answer NO.

Example 1:

Input: 1146 2336 1 2 2 3 1 3 380 599 245 632 692 958 262 425 150 212 49 496 120 507 344 446 86 878 96 321 197 706 589 628 342 804 511 991 780 842 476 906 260 756 122 1042 507 703 792 1094 642 663 196 252 467 775 2 797 204 1092 591 784 650 1006 441 1135 316 482 442 541 76 682 360 809 670 1079 331 744 624 1095 192 719 368 722 630 803 800 1144 378 921 175 564 362 748 128 719 75 273 817 914 843 922 219 1127 626 632 550 1015 287 800 477 593 2 416 314 642 386 836 100 731 549 614 321 397 476 668 440 484 604 788 763 794 430 1069 26 135 240 900 149 762 607 638 50 1035 448 1078 742 1050 8 486 1 22 235 686 26 502 494 810 267 844 345 610 259 360 598 636 173 671 85 874 283 474 309 407 291 783 95 213 569 772 664 756 130 157 505 842 643 1081 553 748 177 644 332 373 622 985 765 941 335 752 97 473 308 491 275 396…
Output: NO

Example 2:

Input: 651 2571 1 2 2 3 1 3 312 323 95 467 332 641 232 450 273 297 90 177 313 381 368 606 223 393 332 500 368 637 383 538 414 635 181 454 4 435 114 406 117 296 19 151 163 620 53 118 209 395 205 450 63 551 140 337 186 205 393 577 33 334 490 614 45 442 275 574 135 449 2 299 72 631 490 498 482 615 363 372 181 246 211 356 199 235 41 519 491 634 414 586 180 402 29 516 54 305 36 315 354 430 248 458 271 465 321 340 261 353 292 323 620 649 252 390 6 203 178 507 198 235 187 516 254 641 216 476 145 375 52 54 219 507 209 488 100 475 114 360 285 478 335 621 102 396 177 612 391 458 555 586 111 467 165 487 267 336 91 320 55 531 247 450 236 253 120 128 19 29 228 252 452 507 431 586 206 245 221 444 186 642 443 625 473 531 560 579 259 352 97 293 148 329 148 461 283 325 238 391 71 199 177 286 12 464 37 605 19 172 …
Output: NO

Example 3:

Input: 425 1424 1 2 2 3 1 3 93 179 22 170 55 251 115 256 281 377 376 417 98 269 248 335 298 339 166 398 25 394 198 421 319 362 3 158 116 231 140 146 22 54 6 316 219 368 159 283 38 83 188 203 158 334 5 103 131 338 187 222 240 387 53 167 183 267 213 385 258 357 38 181 102 322 203 378 28 344 61 319 161 162 240 359 168 206 99 280 186 372 135 373 23 55 91 159 98 311 14 124 154 346 124 304 149 162 78 89 74 149 115 259 59 305 17 378 167 318 7 251 206 257 260 408 10 175 152 203 204 359 110 241 302 309 53 378 180 357 178 221 126 185 121 223 70 399 369 410 128 400 41 226 5 79 49 193 190 413 202 254 2 80 190 245 157 352 36 391 256 268 259 291 130 179 130 290 56 147 237 314 292 395 206 297 38 349 223 350 68 321 162 408 271 315 156 270 52 274 52 261 173 419 114 158 167 185 173 411 98 277 282 361 249 297 39 20…
Output: NO

Constraints:

1 <= n <= 1371; 0 <= m <= 2742; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
The Pale tunnels of Kavya - MEDIUM Coding Problem | CodeTikki