CT51473

Dusky bridges Two Guilds

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Farhan runs the kitchen at the otter slides of Sleekwater. Today the books show a list of bridges, and the numbers must be worked out before sundown. 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 <= 2513; 0 <= m <= 5026; self-edges make the answer NO.

Example 1:

Input: 2328 2400 1 2 2 3 1 3 571 1594 887 1375 480 2316 387 1919 1052 1117 1375 1450 1494 1706 293 1417 1102 1742 2029 2099 239 1875 342 1273 57 306 688 923 685 1733 865 2110 866 1556 362 570 1064 1919 1367 2249 278 790 759 963 432 1755 1064 1856 446 1508 1089 1483 261 2213 580 1952 43 1103 37 1598 2009 2226 387 1321 264 1230 742 1311 1528 2307 388 1395 1709 1983 788 1316 1471 2126 1339 2131 1175 1328 1298 1817 1424 1571 902 1983 264 2262 284 1945 765 861 68 1059 917 1575 1616 2237 813 1319 1729 2231 593 850 416 1325 1145 2158 231 998 79 1708 1303 1336 254 1627 418 770 646 1655 347 391 1118 2163 1645 2293 656 2316 1663 1806 975 1803 1299 1965 1608 1637 183 215 539 1490 768 1996 675 676 472 690 190 708 282 1986 1210 1867 1241 2017 1222 1936 233 1924 243 408 519 597 401 2135 1178 1402 420 1172 24 5…
Output: NO

Example 2:

Input: 423 744 1 2 2 3 1 3 124 337 28 249 41 397 59 325 164 369 30 185 62 335 202 316 23 90 346 361 147 191 15 365 134 332 123 294 82 421 396 409 106 273 44 310 151 250 72 228 19 180 189 384 154 302 349 360 81 116 37 304 35 294 266 398 199 266 45 64 245 257 254 336 159 168 81 258 206 309 9 135 43 391 211 271 29 317 63 169 259 400 376 380 150 296 42 343 44 79 44 385 112 379 175 206 90 243 109 190 299 402 385 396 164 375 234 383 109 230 335 385 86 268 392 422 24 375 52 104 252 304 83 338 197 288 300 357 274 406 52 281 276 329 23 83 9 402 170 252 51 206 2 13 129 418 70 291 55 85 223 399 269 417 1 418 58 363 213 229 304 354 21 204 202 224 91 341 219 337 115 235 291 422 152 402 240 332 67 176 136 337 117 237 158 191 85 154 10 368 66 339 93 206 7 105 155 211 65 107 119 260 378 413 60 336 120 406 218 37…
Output: NO

Example 3:

Input: 1674 4760 274 638 595 818 356 1107 712 1143 787 1250 999 1548 5 96 295 398 154 1035 1121 1586 841 1282 946 1251 602 891 177 682 179 660 442 1028 265 1200 885 946 246 1379 714 1011 365 591 239 903 284 1329 507 923 1080 1431 956 1337 615 1456 1132 1171 1208 1522 838 1671 404 1159 145 1321 1636 1641 1006 1545 266 1089 183 890 229 1531 127 1269 204 701 641 1140 1223 1669 255 377 115 1050 403 693 398 1387 42 818 854 1182 893 997 808 1267 1441 1580 46 721 531 983 68 602 586 827 597 1534 1394 1674 306 901 903 1328 1603 1641 647 1444 140 1344 412 827 348 859 185 1087 868 1547 383 1293 81 1104 101 828 365 1405 193 1237 79 457 1429 1516 888 1634 914 1228 441 1085 1638 1657 127 415 275 583 1361 1481 355 514 159 178 535 1628 789 1109 870 1647 120 145 155 611 405 1344 495 782 325 1105 742 1511 679 951 …
Output: NO

Constraints:

1 <= n <= 2513; 0 <= m <= 5026; self-edges make the answer NO.

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