# | Problem | Pass Rate (passed user / total user) |
---|---|---|
14376 | 2024_DS_Summer_Lab17_Shortest Routes |
|
Description
You're given a undirected graph with n vertices and m edges.
Your task is to process q queries where you have to determine the length of the shortest route between two given vertices.
Input
The first input line has three integers n, m, and q : the number of vertices, edges and queries.
Then, ther are m lines describing the edges. Each line contains three integer a, b, c: there is an edge between a and b whose length is c.
The edges is undirected.
Output
Print the distance of each query.
If there is no route, print -1 instead.