CT63586

Last routes of Botanist

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

The accountant Botanist has been asked to audit the season's records. On the desk lies a long table of routes readings. 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 <= 1998; 0 <= m <= 3996; self-edges make the answer NO.

Example 1:

Input: 1316 1911 1048 1215 1251 1293 135 778 930 1157 137 250 902 1135 752 793 216 285 907 1179 111 319 68 291 485 1092 932 970 991 1087 398 1250 960 1073 788 952 426 792 37 421 684 945 1164 1230 115 428 624 961 308 801 1017 1176 245 661 401 927 578 962 1303 1304 75 451 94 201 683 818 1207 1265 701 905 118 549 499 1079 874 887 583 607 220 395 792 981 809 931 264 466 1223 1255 36 908 459 1288 728 1006 935 984 58 925 38 256 580 673 160 1236 368 552 490 948 122 132 830 1158 589 668 343 353 757 964 753 1050 138 1281 80 538 257 806 239 554 1115 1305 484 718 567 877 302 379 1153 1222 1083 1167 344 451 1209 1234 272 533 514 610 225 515 292 817 269 442 612 832 1153 1226 217 999 86 866 59 680 311 1086 144 403 630 1094 207 752 610 1129 254 1149 59 201 260 679 897 898 354 1162 469 951 465 1315 427 1019 77 1…
Output: NO

Example 2:

Input: 431 629 89 341 329 354 49 50 49 424 28 73 318 329 74 184 105 430 130 379 226 288 194 308 16 126 219 315 23 219 96 231 162 342 38 92 178 257 53 312 167 328 185 332 34 372 307 377 90 353 388 418 312 336 19 431 72 229 52 271 36 338 29 269 187 309 306 373 156 280 342 419 31 84 27 163 43 74 131 135 217 327 331 418 198 300 17 104 240 292 111 401 113 308 223 415 102 388 10 238 9 45 189 245 237 263 316 430 103 154 154 352 174 241 110 309 37 424 60 65 108 299 292 355 148 300 132 335 129 306 7 177 145 367 73 202 23 75 130 157 25 227 23 342 36 225 84 363 43 284 227 237 235 381 121 157 189 395 269 324 50 205 77 220 244 336 130 247 175 239 117 337 82 87 221 353 133 413 193 326 227 253 8 25 129 225 401 426 153 258 160 319 137 329 263 297 19 294 71 192 36 99 252 296 171 329 157 352 270 292 14 185 36 189 …
Output: NO

Example 3:

Input: 1630 214 1121 1595 1107 1329 86 380 596 1499 135 1171 1466 1540 1207 1545 1359 1376 988 1427 1508 1554 282 827 1066 1347 462 1317 1084 1093 1081 1206 430 1573 161 658 570 746 1079 1486 72 868 371 1186 217 1062 394 1426 952 1294 170 487 1162 1402 224 314 200 1313 124 239 243 695 1025 1461 611 819 1047 1222 96 1601 525 1494 1322 1443 850 998 432 673 12 766 179 332 255 718 487 685 1041 1048 102 1142 709 889 441 1034 514 1420 56 681 173 226 588 861 437 1146 899 1119 1280 1605 90 1362 493 829 1099 1246 578 738 1114 1380 814 1066 440 637 250 1149 333 984 579 1255 1175 1546 380 690 108 1222 799 1029 1145 1450 1380 1496 792 1535 345 1399 266 1300 151 1187 51 1314 269 1179 63 691 539 1174 158 601 113 510 577 1494 481 557 812 1104 633 1431 53 1384 360 1552 204 315 1042 1086 216 1007 330 372 1028 133…
Output: YES

Constraints:

1 <= n <= 1998; 0 <= m <= 3996; self-edges make the answer NO.

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