3051 - 2024_DS_Summer_Lab17 Scoreboard

Time

2024/08/14 14:39:00 2024/08/28 23:59:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
14376 2024_DS_Summer_Lab17_Shortest Routes

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.

 

Sample Input  Download

Sample Output  Download

Tags




Discuss