Dotcpp  >  编程题库  >  Mirror’s Edge(K)
题目 2204:

Mirror’s Edge(K)

时间限制: 3s 内存限制: 192MB 提交: 18 解决: 2

题目描述

Assuming that you are playing a video game Mirror’s Edge. Mirror’s Edge is a parkour game, in which you are required to move your role around the map to convey secret information. The map will be described by n areas and m two-way paths that connect two different areas. At the very beginning of the game, you are in area 1 and then you need to arrive area a,b,c,d,e, but no order is required. Undoubtedly, you would like to find the fastest path.

输入格式

The first line contains two integers n and m. The second line contains five integer a,b,c,d,e. The next m lines, each line describes a path. Each line contains three integers x,y,t, indicating this line connect area x and area y and it will cost t seconds to pass it.

输出格式

A integer t indicates possible shortest time.

1≤n≤500000,1≤m≤1000000;
1<a,b,c,d,e≤n;
1≤x,y≤n,1≤t≤100;

样例输入

6 6 
2 3 4 5 6 
1 2 8 
2 3 3 
3 4 4 
4 5 5 
5 6 2 
1 6 7

样例输出

21

提示

零基础的同学可以先学习基础,教程见:  C语言教程C++教程编译器教程数据结构教程Python教程单片机教程

视频教学见视频网课

标签