Set 105Question 61

Mahi's Weighted Shortest Route

Very hardWritten in CMust finish in 5 seconds

Mahi needs the shortest weighted route between two hubs in the delivery network used at a weather station, along with the actual path.

What your program reads

Line1: N M S T. Next M lines: u v w.

What your program prints

Shortest distance and one valid path.

Limits

1 ≤ N ≤ 2×10^5

Example input

4 4 1 4
1 2 1
2 3 2
3 4 1
1 4 10

Expected output

4
1 2 3 4
main.c

Your work is saved in this browser as you type.

Loading editor…
Input for Run

Run tries your code on the input above and shows what it prints. Submit checks your output against every test, including hidden ones.

Shortcut: Ctrl + Enter sends it to the judge.

Mahi's Weighted Shortest Route · DIU ContestHub