https://qoj.ac/contest/2506/problem/14018
I've reformulated this problem to finding the shortest path from $$$0$$$ to other vertices in the graph G that connects from vertex $$$i$$$ to vertex $$$j$$$ with weight $$$a[(j-i+\text{minpos})\text{ mod }n] - a[\text{minpos}].$$$
This is equivalent to substituting $$$minpos$$$ with $$$j-i$$$ (in the list of elements that constructs $$$j$$$). But I don't know where to go from here.
The fastest solution iterates through the distinct edges and for every vertex, it basically jumps repeatedly on that edge until it can't relax more.
Can anyone prove the asymptotic behavior and the correctness of the above algorithm?




