CT63694

The Honeyed routes of Aria

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

The council of the lily shoals of Padmore pays by the answer, and Aria intends to earn it. First: the full register of routes. Task: An undirected weighted graph is given. Print the shortest-path cost from s to t, or -1 if unreachable. Input format: First line: n m s t. Next m lines: u v w. Output format: Print the shortest distance or -1. Constraints: 1 <= n <= 986; 0 <= m <= 2958; 1 <= s,t,u,v <= n; 0 <= w <= 1000; distance fits 64-bit.

Example 1:

Input: 883 1083 1 883 513 554 939 47 522 842 145 509 600 97 215 391 356 619 732 367 531 313 399 831 293 165 309 656 292 297 120 146 434 249 270 318 199 156 709 495 208 273 25 238 401 619 199 598 596 269 463 175 378 666 133 391 417 741 385 646 799 7 201 275 10 442 447 138 794 299 327 428 13 343 434 313 115 307 715 253 723 313 142 669 27 344 594 578 292 369 783 329 524 247 195 747 667 324 609 358 310 340 431 9 606 975 497 569 324 340 401 180 45 573 531 134 542 961 197 302 830 190 482 718 289 695 361 688 694 129 549 719 643 326 412 542 99 139 203 20 147 927 140 247 219 546 796 440 259 830 921 128 877 392 170 346 301 46 240 217 149 657 729 132 620 741 179 395 228 133 368 646 670 725 110 83 584 598 175 827 375 467 548 271 521 638 532 48 562 852 76 79 862 529 762 301 155 200 595 286 821 854 2 147 133 3…
Output: 4469

Example 2:

Input: 175 1944 1 175 10 110 156 127 167 462 11 123 410 85 97 604 157 159 134 43 172 771 90 168 828 106 110 346 8 47 152 53 66 839 107 152 348 21 76 692 59 165 859 4 99 10 17 46 682 31 124 38 105 165 239 36 112 533 11 49 626 22 101 493 19 70 66 53 82 680 61 135 81 106 159 776 26 107 455 32 39 469 64 164 460 31 166 909 88 105 985 56 136 765 58 160 998 30 45 415 52 129 423 41 100 122 126 144 400 10 96 725 58 98 658 79 132 912 42 108 871 7 55 156 87 144 763 39 118 431 110 130 443 34 86 193 17 20 153 100 147 957 5 160 106 27 125 984 22 148 222 69 102 495 89 128 544 13 52 418 92 153 662 27 101 934 32 161 171 5 55 943 25 106 108 82 160 277 30 162 138 82 144 677 1 112 109 106 170 648 72 80 537 7 118 112 113 158 615 61 115 985 55 79 759 29 138 3 106 145 475 46 147 311 13 164 720 65 136 350 17 78 322 25 6…
Output: 184

Example 3:

Input: 885 2834 1 885 406 531 924 225 317 26 230 456 660 46 879 718 13 479 430 469 615 100 6 631 461 99 103 616 3 356 993 173 457 170 54 199 986 1 658 550 479 684 733 463 620 124 730 812 453 598 737 740 192 309 829 47 211 831 375 772 205 3 244 372 13 562 334 82 846 604 299 501 58 34 184 29 67 101 792 56 457 156 527 707 28 69 788 786 329 812 332 222 679 738 370 801 184 284 729 921 278 373 151 418 658 503 474 574 446 115 724 566 59 717 384 302 812 617 181 315 524 236 830 211 352 495 594 35 383 811 76 257 920 271 736 803 343 709 879 114 120 468 152 695 190 781 823 487 193 830 883 95 141 443 31 704 995 65 216 537 402 433 763 471 655 873 167 230 913 64 755 933 64 817 406 113 612 864 104 267 585 185 434 946 31 519 716 89 307 258 726 809 811 11 795 127 54 850 186 451 773 574 526 601 1 188 672 949 429 48…
Output: 1631

Constraints:

1 <= n <= 986; 0 <= m <= 2958; 1 <= s,t,u,v <= n; 0 <= w <= 1000; distance fits 64-bit.

Loading...
Test Cases:No test cases
No test cases available.
The Honeyed routes of Aria - MEDIUM Coding Problem | CodeTikki