https://www.acmicpc.net/problem/status/8452
the problem is
A directional graph G is given. When the length of all trunks is 1, you must process two queries.
- Remove one trunk.
- Outputs the shortest path from vertex 1 to vertex i. If there is no path, -1 is output.
|V| <= 10^3, M, Q <= 10^5
Rather than removing edge, we will define cost to an edge, which is either infinity or the time of edge removal.
Now make a DP table analogous with Bellman-Ford. (dp[i][j] = min cost over all edges, for all path 1 ~ i of length <= j). Respond every query by binary search.
thanks. i think I know how to solve this now