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

Mirror’s Edge(K)

时间限制: 2s 内存限制: 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、百练、蓝桥杯辅导、算法数据结构等课程,提供视频讲解以及配套习题,还有老师答疑,点击这里了解课程详情
标签