Can someone explain me the suggested algorithm?

Правка en2, от yoshi_avx, 2026-07-18 05:02:55

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?

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский yoshi_avx 2026-07-18 05:02:55 46
en1 Английский yoshi_avx 2026-07-18 04:57:56 688 Initial revision (published)