CT55095

Nico and the Whispering roads

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Deep in the cotton rows of Whitewick, Nico studies rows of roads entries. One clean number will settle the guild's oldest argument. 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 <= 2222; 0 <= m <= 4444; self-edges make the answer NO.

Example 1:

Input: 546 1718 71 545 250 407 300 428 353 432 194 510 77 197 90 358 301 362 29 128 179 474 54 324 314 353 206 295 24 544 36 429 234 415 347 358 207 513 129 468 312 522 220 457 444 510 161 386 153 374 413 522 70 248 149 360 307 351 232 298 243 304 230 540 34 352 329 480 16 535 211 314 7 23 286 375 421 542 103 364 247 424 36 355 333 378 484 503 120 156 159 481 248 302 9 142 196 253 118 265 138 496 53 481 6 413 250 470 366 492 259 455 323 488 81 129 167 466 77 430 9 313 39 207 140 350 28 177 32 34 459 468 228 418 103 433 127 466 41 129 224 341 20 108 446 467 391 393 287 375 206 415 106 536 109 173 435 452 109 456 305 479 301 442 216 501 24 441 14 91 27 473 32 70 81 421 96 127 162 404 159 507 203 319 44 196 109 114 29 270 46 394 274 528 270 509 28 313 25 453 375 498 140 467 44 80 147 198 122 352 11 …
Output: NO

Example 2:

Input: 684 4270 1 2 2 3 1 3 445 569 112 638 132 475 45 473 31 550 210 237 381 620 266 518 201 211 38 201 106 481 354 404 198 209 95 591 95 670 402 566 319 353 16 604 455 632 161 406 146 223 105 467 89 670 567 605 288 647 32 416 104 204 275 306 264 485 392 585 215 611 112 173 71 277 75 291 410 638 82 373 33 612 57 663 97 550 361 413 548 644 69 530 183 596 60 257 85 414 511 653 58 201 416 486 374 546 9 376 415 484 391 412 270 591 206 519 17 631 463 581 147 451 89 432 67 594 143 445 12 574 182 630 612 639 460 611 478 569 157 430 431 506 458 569 67 373 35 556 174 545 5 680 36 163 429 528 357 495 1 463 604 673 166 279 59 204 298 381 462 679 171 667 73 109 102 367 174 327 126 332 338 402 273 489 62 137 35 336 410 630 144 414 91 664 13 378 196 671 244 565 246 299 40 314 351 366 100 414 44 452 315 567 39…
Output: NO

Example 3:

Input: 1960 2561 1041 1221 737 1015 898 1143 371 562 686 1100 1328 1937 1154 1679 1839 1890 16 710 310 1457 234 1066 151 1248 1131 1737 239 1638 134 524 559 805 1150 1263 1050 1430 1342 1889 629 1100 53 1079 111 1667 113 290 701 1197 181 1400 461 698 721 1214 530 923 1212 1287 459 1866 829 1512 666 825 131 197 206 1536 275 467 622 1952 388 665 1448 1614 893 1712 609 1250 233 916 647 1120 162 1555 298 1877 725 1559 1023 1500 883 1499 1375 1708 158 434 849 1624 337 572 828 1671 1120 1241 36 681 398 679 949 1234 1392 1439 702 1152 1339 1680 843 1693 116 1310 455 1392 345 900 1023 1880 1205 1594 1082 1233 367 835 62 780 1673 1697 1765 1804 561 1437 466 841 368 1677 826 960 530 982 8 1228 899 910 211 1928 97 1247 1382 1643 879 1547 309 1202 642 995 967 1489 1023 1152 1060 1222 671 963 147 1187 338 390…
Output: NO

Constraints:

1 <= n <= 2222; 0 <= m <= 4444; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
Nico and the Whispering roads - MEDIUM Coding Problem | CodeTikki