CT59956

Rosa's Quiet canals

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Morning light hits the coastal hub of Tidewater as Rosa unrolls the day's manifest of canals. The tally will decide the next shipment. 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 <= 2490; 0 <= m <= 4980; self-edges make the answer NO.

Example 1:

Input: 809 1538 1 2 2 3 1 3 414 513 584 607 31 369 151 314 408 519 258 339 477 683 271 467 139 417 376 484 261 656 321 791 70 579 112 809 19 604 459 654 4 175 177 270 124 301 101 213 270 602 397 409 273 692 446 473 45 293 74 666 617 791 132 426 275 587 148 688 189 643 36 755 19 222 230 305 464 490 199 588 141 321 186 762 472 608 281 760 90 503 639 735 156 683 277 470 396 427 329 674 445 625 666 793 172 586 162 288 274 720 120 183 390 594 83 110 577 787 305 593 202 661 435 505 75 212 45 557 188 563 433 669 621 689 157 163 187 688 222 559 60 174 274 698 63 321 479 719 139 222 702 779 145 474 533 573 2 240 40 577 112 198 576 681 287 615 440 556 332 761 129 783 89 415 389 520 81 215 98 296 504 759 122 332 84 615 128 461 152 578 439 660 1 134 493 662 352 642 286 747 350 357 226 530 165 432 31 420 129 …
Output: NO

Example 2:

Input: 1856 1094 1 2 2 3 1 3 672 1805 76 1689 503 1160 968 1581 1035 1247 558 1092 628 1539 927 1170 367 648 255 1051 102 829 1257 1447 421 1262 28 914 1545 1733 122 1540 1035 1333 30 1191 83 562 1174 1446 1638 1735 673 1631 651 1031 404 921 1576 1607 99 993 925 1779 68 1738 816 1152 456 832 1607 1847 1347 1424 351 1313 230 352 485 827 105 1177 191 933 550 979 337 412 1215 1311 1088 1179 1502 1553 488 1564 337 1421 864 1701 797 1609 796 1289 729 1753 819 1102 562 603 385 1039 652 846 245 629 412 1478 95 428 257 1407 1118 1634 1636 1798 270 695 1032 1649 1175 1363 23 1827 40 1291 1251 1369 291 1012 393 1431 1210 1769 511 517 98 807 816 1596 475 1028 695 911 294 1653 149 591 716 1241 825 1509 973 1405 77 508 751 1513 877 1685 809 1189 590 1726 870 894 437 471 637 1134 152 162 929 1407 691 1197 1027…
Output: NO

Example 3:

Input: 345 965 107 267 210 247 174 216 3 218 23 251 190 285 179 301 85 267 270 307 47 216 188 261 2 336 43 120 15 332 107 145 122 159 106 338 149 294 69 294 191 238 98 257 38 297 153 275 11 215 124 174 34 272 71 279 184 243 90 131 168 314 74 288 21 327 274 281 21 64 50 290 189 255 17 48 40 222 32 47 14 28 168 328 67 225 173 294 2 333 225 310 118 323 182 191 11 230 67 96 144 188 187 246 103 125 275 337 234 311 144 233 62 91 119 249 186 269 106 137 211 238 256 264 12 321 59 130 173 310 115 269 111 278 91 92 84 140 62 208 63 98 119 258 104 170 177 213 43 232 301 334 177 305 169 204 22 81 126 307 17 81 45 234 159 166 86 213 116 191 117 294 24 294 141 179 89 151 232 242 83 215 18 56 174 278 123 186 68 337 129 229 270 328 45 74 190 255 148 308 194 325 159 214 193 298 141 321 180 300 144 213 179 275 40 …
Output: NO

Constraints:

1 <= n <= 2490; 0 <= m <= 4980; self-edges make the answer NO.

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