CT59340

Bram and the Faded tunnels

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Bram found an old ledger of tunnels in the gallery attic at the basalt cliffs of Obsidian Shore. The margin notes pose a precise question. 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 <= 2904; 0 <= m <= 5808; self-edges make the answer NO.

Example 1:

Input: 2538 4536 1 2 2 3 1 3 1277 1770 1334 2162 924 1839 1761 2120 1615 2268 1921 2253 658 2475 623 1613 872 2099 300 2298 1302 2195 684 2370 1688 1902 1463 2410 861 2311 64 905 30 326 432 2267 925 1126 1504 2449 888 1292 1146 2527 746 1169 167 442 377 2095 425 2325 975 2433 1362 1525 499 838 2020 2121 944 1551 173 1131 503 735 994 1357 815 1337 1087 1777 1406 1714 1016 1370 1973 2265 939 1852 504 2371 678 1659 11 1262 1118 2203 1788 2447 25 834 964 1425 984 2082 1422 1963 748 1246 9 1352 2089 2404 635 1979 1538 1600 857 896 995 1071 58 357 2020 2336 1940 2456 729 1986 98 1403 145 280 333 2345 726 1589 1347 2019 320 2519 327 2330 208 1627 521 1463 1946 2415 288 2327 1340 2094 439 2206 1090 1644 259 556 101 1088 759 1256 1456 1507 1435 1738 1887 2527 703 1503 261 2489 1534 1549 284 880 110 1835 9…
Output: NO

Example 2:

Input: 1887 1054 1441 1480 267 1282 311 1082 849 1272 662 1734 157 1213 529 827 64 1679 341 820 1329 1705 367 1334 517 1325 107 1534 107 1379 773 1086 793 1668 409 1849 552 1183 58 1457 1003 1775 710 1257 305 1076 1520 1861 349 1755 87 603 958 1051 1606 1833 273 1872 385 733 194 1220 1308 1387 1031 1824 955 1022 408 1665 893 1305 179 460 446 1111 555 707 802 963 1044 1821 243 578 1073 1593 647 839 135 1175 280 1546 650 1214 252 407 1140 1592 279 1799 509 1877 54 925 62 1636 70 621 980 1370 1563 1777 1166 1266 754 1776 325 463 997 1095 310 1066 189 1253 944 1519 1089 1090 1085 1829 736 1773 484 1036 1271 1716 193 1862 623 1278 1473 1856 1393 1504 1 935 800 1642 398 1109 606 1642 752 1024 1074 1796 92 819 904 1754 217 1302 1336 1611 1054 1074 592 1181 999 1547 90 1671 999 1720 597 1434 393 715 624 …
Output: NO

Example 3:

Input: 318 3165 127 153 179 183 41 61 45 194 123 313 230 273 59 252 95 259 117 196 127 274 137 275 99 179 11 155 23 38 224 288 160 164 141 192 18 201 104 190 191 223 149 290 202 274 54 190 118 132 116 299 20 82 18 118 118 211 49 217 78 133 53 217 197 290 77 314 118 240 166 222 113 231 116 202 69 198 47 273 57 293 109 234 54 160 18 302 173 221 10 180 221 225 25 293 18 25 181 253 3 155 223 284 200 230 101 239 72 223 11 282 56 156 87 218 17 283 17 111 47 198 87 95 57 227 42 236 179 195 38 117 149 280 7 20 36 174 186 274 116 140 68 133 278 283 55 135 193 271 258 264 56 248 204 241 132 257 84 124 124 234 93 278 70 291 162 291 73 136 10 152 50 267 92 222 107 218 55 303 63 193 7 131 234 287 39 164 179 212 17 162 42 114 115 305 140 221 39 122 144 194 234 315 146 234 265 295 106 233 10 81 86 233 259 260 1…
Output: NO

Constraints:

1 <= n <= 2904; 0 <= m <= 5808; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
Bram and the Faded tunnels - MEDIUM Coding Problem | CodeTikki