Impressions
Training for two weeks, I felt level is rising, very good. Yesterday CF make up five questions today to update the blog.
This problem is CodeForces1196 last question, a div3 of.
Chinese 题意
To a \ (n-\) points \ (m \) no connected graph of edges, so that all seek the shortest in this figure, the \ (K \) short shortest (switching starts and ends with the calculation one way).
Problem-solving ideas
The official said so solution to a problem -
1196F - K-th Path
The main observation is that you don't need more than smallest by weight edges (among all edges with the maximum weights you can choose any). Maybe there will be a proof later, but now I ask other participant to write it.
So you sort the initial edges and after that you can construct a graph consisting of no more than vertices and no more than edges. You just can build the new graph consisting only on these vertices and edges and run Floyd-Warshall algorithm to find the matrix of shortest paths. Then sort all shorted distances and print the -th element of this sorted array.
Time complexity: .
I know that there are other approaches that can solve this problem with greater , but to make this problem easily this solution is enough.
哈哈