CT52811

The Ashen Two Guilds

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Deep in the gull cliffs of Screech Point, Nico studies rows of bridges entries. One clean number will settle the guild's oldest argument. 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 <= 3100; 0 <= m <= 6200; self-edges make the answer NO.

Example 1:

Input: 1633 3938 982 1633 224 356 1377 1558 787 833 197 508 839 1378 790 1605 673 1129 346 871 323 1168 608 879 272 1077 36 567 1146 1599 1343 1442 159 1210 219 539 811 986 581 1415 1040 1250 1424 1498 120 1344 377 846 1074 1496 1011 1243 164 1327 489 1193 231 1087 711 845 517 724 373 1054 421 425 1045 1312 23 320 446 1571 598 629 1078 1344 101 1321 583 1467 138 1371 773 869 302 1289 152 231 72 162 296 1357 31 790 439 1426 901 1351 648 1621 353 763 1239 1344 324 364 135 587 131 827 214 1282 800 1538 322 441 522 698 312 1537 135 246 50 288 767 993 7 236 240 692 394 1174 580 978 322 407 110 976 97 1257 701 1148 450 624 112 1430 597 1478 69 963 1006 1528 1032 1093 610 885 453 726 477 992 1358 1413 61 1435 7 1094 852 1107 92 1494 115 424 1081 1476 551 1063 309 831 118 211 25 178 915 969 620 1261 252 …
Output: NO

Example 2:

Input: 695 4575 1 2 2 3 1 3 118 232 222 398 273 393 121 537 187 246 110 427 271 286 357 441 18 643 200 273 318 663 444 516 35 620 51 459 386 518 1 680 6 163 340 381 375 479 40 253 51 503 24 215 228 428 258 635 91 614 144 380 643 660 79 364 439 583 534 688 291 550 277 480 101 396 7 471 396 593 7 223 404 623 14 104 180 563 31 369 492 597 467 627 358 548 133 218 266 280 103 435 474 589 99 223 271 418 51 661 110 640 98 690 156 228 454 501 44 324 9 620 219 302 228 552 185 511 429 693 427 622 209 694 499 579 182 483 166 612 427 486 4 457 222 385 113 269 89 96 267 662 180 241 557 691 250 319 305 694 15 384 254 601 336 617 171 430 428 576 123 228 90 315 83 141 298 594 155 403 301 550 77 567 125 193 365 460 320 561 66 486 233 641 155 337 212 481 93 594 302 434 531 653 37 546 241 375 33 471 173 189 188 558…
Output: NO

Example 3:

Input: 197 4189 4 167 93 139 83 169 35 41 131 162 37 85 50 112 126 189 140 150 8 19 23 31 66 127 70 85 79 96 26 197 39 86 118 173 31 169 43 144 19 142 17 194 88 143 37 54 7 34 77 118 71 112 39 153 36 42 73 147 20 114 147 157 159 167 24 26 55 133 71 143 87 152 3 21 160 195 6 104 50 75 113 168 171 180 108 141 24 172 46 177 103 124 124 175 3 169 64 157 74 147 131 136 150 163 141 164 41 85 30 73 76 86 166 194 109 158 28 63 124 160 43 129 1 150 155 197 80 89 70 139 47 162 40 174 105 189 63 137 155 182 14 191 34 125 16 41 17 25 77 96 65 172 26 55 77 78 152 162 36 117 2 7 130 196 38 113 83 133 39 40 109 180 19 101 77 124 42 45 140 165 47 85 129 135 153 192 44 186 9 41 36 156 143 179 78 197 4 146 7 42 90 167 61 175 3 140 33 52 84 118 140 193 76 164 147 156 85 165 110 185 2 83 7 29 162 164 25 44 13 52 13 …
Output: NO

Constraints:

1 <= n <= 3100; 0 <= m <= 6200; self-edges make the answer NO.

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