CT57440

The Two Guilds Beneath Gusthaven

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

In the windmill fields of Gusthaven, Finn the reckoner keeps careful count of the bridges. assign crews to the morning shifts, every figure matters. 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 <= 2264; 0 <= m <= 4528; self-edges make the answer NO.

Example 1:

Input: 2043 4300 247 1479 1000 1734 378 1574 412 1253 286 1047 540 1880 156 549 508 949 386 1561 1536 1907 388 443 1679 1756 562 1012 1471 1619 551 1961 535 1688 968 1324 189 1352 1041 1779 541 1664 1321 1386 1598 1658 5 441 48 251 1054 1094 631 763 1618 1634 338 447 633 1923 831 928 1432 2020 980 1472 1631 1897 492 1091 741 1309 763 1761 1123 1415 717 1153 789 1490 357 1069 524 1172 1492 1522 879 1458 1076 1217 924 1995 710 1198 176 796 701 1717 279 1775 496 544 105 520 321 770 172 1311 1466 1669 724 1449 633 1469 1536 1994 152 1035 748 1184 262 2018 32 1988 1704 1903 983 1353 259 449 980 1664 346 1215 1018 1167 850 1670 175 817 1346 1853 23 938 1226 2030 830 1477 916 1541 621 1506 101 1055 87 166 427 610 1294 1830 840 998 1158 1163 905 1140 701 1082 1284 1314 1544 1614 472 642 1104 1984 133 395…
Output: NO

Example 2:

Input: 1698 505 1 2 2 3 1 3 51 1450 792 979 396 989 1301 1493 339 640 12 1644 286 400 465 1532 1223 1648 1308 1657 34 1249 856 1422 207 1060 879 1115 817 964 1358 1474 1423 1610 340 897 229 1620 411 1193 200 360 8 409 1188 1263 839 1047 293 1554 661 1030 1172 1310 444 1543 343 1365 1178 1684 164 938 943 1124 892 1099 978 1439 55 648 1041 1343 579 1054 625 943 225 598 660 1417 605 1634 235 1007 396 525 924 1222 15 672 35 657 119 198 164 1620 3 1673 715 1685 235 1297 737 1425 817 940 423 1154 81 537 663 721 53 852 1293 1439 339 653 363 1672 879 1518 1426 1690 226 1680 855 1478 203 862 499 680 424 1327 614 1283 336 1688 281 666 272 1429 179 764 322 1335 289 1365 283 1610 298 343 1011 1097 2 271 120 318 139 774 356 1571 775 1230 1180 1417 396 1424 361 790 931 1266 627 639 211 1211 497 1280 480 1220 5…
Output: NO

Example 3:

Input: 433 3796 326 359 253 397 30 59 202 259 326 428 201 426 146 377 285 335 216 293 119 242 243 332 152 314 166 169 180 394 379 404 130 370 218 230 236 289 233 362 100 356 94 280 36 120 36 223 48 221 158 231 31 432 40 281 209 341 80 275 137 188 167 345 245 405 98 323 190 332 77 185 41 354 299 344 85 316 186 416 162 384 198 378 92 284 80 188 84 199 55 56 199 207 39 299 198 211 339 371 124 354 67 349 259 271 108 203 41 286 77 357 58 282 121 253 168 386 90 229 149 408 100 369 124 427 85 246 225 232 153 383 234 293 248 324 6 297 298 410 121 309 226 393 44 246 167 332 349 365 12 230 240 326 285 390 60 241 214 351 103 107 354 399 95 262 126 324 15 353 234 345 39 114 47 384 309 431 9 152 9 225 219 331 307 389 56 192 158 348 79 388 76 105 63 242 38 105 10 317 19 209 94 278 46 49 129 259 86 264 216 243 …
Output: NO

Constraints:

1 <= n <= 2264; 0 <= m <= 4528; self-edges make the answer NO.

Loading...
Test Cases:No test cases
No test cases available.
The Two Guilds Beneath Gusthaven - MEDIUM Coding Problem | CodeTikki