CT54948

The Two Guilds of Alabast

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The harbor bell rings at the ivory gates of Alabast; Omkar weighs the day's corridors manifests and starts the calculations. 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 <= 2879; 0 <= m <= 5758; self-edges make the answer NO.

Example 1:

Input: 554 1729 1 2 2 3 1 3 17 264 65 327 220 368 408 496 106 521 419 539 37 450 212 384 40 307 249 461 79 492 119 222 343 544 263 522 131 306 113 225 241 319 106 396 248 501 187 356 13 535 330 414 343 540 209 451 40 393 61 264 258 346 294 470 121 318 249 547 48 170 280 545 240 457 9 365 248 531 198 399 184 355 325 533 341 481 239 322 118 488 25 265 137 440 159 538 50 200 424 466 181 517 51 98 252 346 91 159 262 264 138 305 61 344 193 551 40 540 51 535 244 532 17 120 214 467 47 310 208 434 158 236 49 307 483 545 74 377 104 143 165 247 325 502 336 373 20 272 179 277 313 340 273 282 282 520 294 303 221 255 133 274 277 382 286 549 24 33 5 102 42 272 143 223 189 196 26 131 183 432 59 532 445 547 15 380 77 428 115 479 341 526 82 431 518 551 149 523 100 195 325 453 180 246 65 379 434 483 105 352 303 30…
Output: NO

Example 2:

Input: 2726 5216 456 1886 477 1313 2008 2224 484 2561 2 1139 460 2153 265 2368 1800 1967 1590 2073 1091 1669 149 2217 2480 2647 92 494 1668 1853 1144 1693 68 2449 449 2221 1867 2137 1439 2667 668 2244 438 513 1278 2291 949 2585 1423 1749 385 2634 210 1903 1200 1714 2482 2691 1763 2106 800 1520 283 424 90 1384 1494 2567 1306 2060 2155 2690 1265 2469 1937 2677 1632 2101 674 2510 221 2254 1257 1969 1922 2532 736 1446 2040 2220 392 440 285 1371 250 872 1992 2524 2010 2154 263 1128 653 1609 1934 2525 1003 1300 1938 2079 476 685 2123 2635 1041 1871 375 1250 1215 1660 416 1758 352 2590 581 1992 698 2577 504 1056 1035 1968 697 1741 1167 1714 93 2141 1084 2234 1850 2240 58 1599 481 695 1671 2267 932 1090 984 2044 2538 2539 781 2573 242 1317 135 2374 44 647 686 933 709 1380 7 1694 1284 2426 1380 2085 328 6…
Output: NO

Example 3:

Input: 2121 1689 453 986 444 581 278 1579 57 1515 905 1559 1075 1195 257 1405 394 1398 15 1152 1223 1293 1248 2007 337 1466 102 449 356 1747 521 973 1456 2033 571 818 273 1987 952 1402 565 1678 560 1822 571 848 1249 1449 894 1263 1206 1357 182 472 443 1825 1291 1404 711 2026 991 1418 782 1440 109 2047 518 626 970 1674 1169 1898 988 1223 1041 1232 672 1553 509 1954 1283 1909 111 1724 298 1929 206 1857 461 1542 715 1956 338 1957 1838 1980 1238 1303 622 1703 5 181 495 1264 1197 1722 805 1940 1320 1781 53 193 229 1912 1192 1828 359 1924 573 1757 989 1056 314 1568 93 252 737 1354 661 1327 1467 1625 116 636 368 774 1423 1441 20 874 180 1257 1830 1998 198 1766 736 737 623 1474 783 1883 1370 1692 418 1673 116 1611 864 906 412 573 221 993 299 1190 716 1546 1153 1186 1167 1665 587 1309 385 1198 843 1347 42…
Output: NO

Constraints:

1 <= n <= 2879; 0 <= m <= 5758; self-edges make the answer NO.

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