CT63333

Kate's Ledger of canals

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Morning light hits the silver mines of Lodebarrow as Kate unrolls the day's manifest of canals. 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 <= 2761; 0 <= m <= 5522; self-edges make the answer NO.

Example 1:

Input: 660 5120 1 2 2 3 1 3 529 532 448 584 187 613 106 600 162 198 16 207 102 638 272 362 105 558 241 642 58 538 99 590 4 212 320 490 416 621 314 506 175 428 180 320 209 284 332 463 487 647 314 563 109 464 146 217 236 262 429 597 23 367 62 160 128 647 29 39 65 639 219 600 6 381 191 255 269 317 413 463 406 417 147 339 230 489 423 613 117 255 25 582 26 124 403 428 427 514 276 434 129 291 313 587 362 453 33 534 26 466 83 612 636 656 187 259 82 474 213 627 213 537 298 583 30 443 41 120 327 634 60 79 143 330 104 590 627 644 417 621 390 490 323 466 84 591 117 425 313 353 440 589 76 217 25 585 364 402 357 659 36 317 517 620 82 97 98 407 54 521 90 511 241 316 36 160 193 422 415 547 271 599 172 312 311 593 93 276 28 201 12 438 222 410 117 351 203 411 621 639 593 641 261 490 317 650 481 639 5 602 45 511 8…
Output: NO

Example 2:

Input: 2496 1900 422 2478 355 1307 292 1549 1600 1720 534 1720 1899 2429 133 1319 626 2035 71 888 1219 2402 1023 1353 582 1052 418 1135 451 1805 123 1893 1421 2445 589 640 1882 2190 371 2199 1048 1302 471 1061 326 1862 1212 2422 2303 2452 655 1545 640 1127 1924 2010 1858 2300 1365 2353 128 989 361 2293 1592 1682 581 1971 588 742 69 748 930 1003 283 1000 633 2392 320 1204 1150 2301 396 2304 621 2003 84 813 685 1418 1685 2439 1413 1714 1017 1835 382 1804 612 808 301 2437 1547 1639 60 1627 57 349 1090 1406 1201 1868 578 1552 39 2034 1189 1238 929 2490 268 2177 137 2036 287 1246 445 629 1034 1562 275 1887 1308 1695 1049 1594 1629 2093 712 2202 1301 1851 1134 1216 811 1700 983 1620 467 891 683 2359 2022 2090 898 1920 50 1877 1232 2031 1827 2246 1122 1838 1040 2145 325 2317 309 815 137 867 384 2029 251…
Output: NO

Example 3:

Input: 1743 1563 433 1064 13 1637 498 1099 342 1173 711 930 145 604 40 817 1266 1608 1120 1175 617 1237 667 1408 1440 1641 1384 1388 118 1659 1292 1516 684 1511 303 1499 343 388 226 829 70 616 891 1603 167 1711 37 1387 167 1353 562 1108 317 1093 559 1687 1058 1641 603 1624 44 1307 522 1488 959 1022 932 1495 1586 1742 599 1197 12 1131 1115 1668 546 897 193 438 1021 1285 34 514 754 1202 558 1108 633 1410 622 1154 109 1355 99 516 505 1614 686 1629 271 1352 1169 1232 638 1216 1439 1508 323 1412 414 795 949 1145 309 1011 625 659 479 953 199 889 1286 1629 46 1502 540 960 417 654 901 1433 276 1612 90 615 428 1618 933 1096 897 1107 630 800 879 1605 127 227 1530 1663 978 1616 1330 1554 851 906 1351 1609 93 269 849 1234 1417 1648 262 956 803 1613 103 282 16 858 330 561 357 948 57 952 700 1076 153 237 285 1…
Output: NO

Constraints:

1 <= n <= 2761; 0 <= m <= 5522; self-edges make the answer NO.

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