/*迪杰斯特拉算法用于解决单源最短路问题,时间复杂度为o(n^2),权值为正*/
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define N 1005
#define INF 0x3f3f3f3f
using namespace std;
int m, n;
int map[N][N];
int dis[N];
int vis[N];
void init()
{
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= n; j++)
{
if (i == j) map[i][j] = 0;
else map[i][j] = INF;
}
}
}
void creatgraph()
{
int t1, t2, t3;
for (int i = 0; i < m; i++)
{
scanf("%d%d%d", &t1, &t2, &t3);//两个顶点和权值
if (map[t1][t2] > t3)//防止重复输入相同节点,但是权值不同
map[t1][t2] = t3;
}
}
void dijkstra(int start)
{
/*下边初始化dis,vis数组*/
for (int i = 1; i <= n; i++)
dis[i] = map[start][i];
memset(vis, 0, sizeof(vis));
vis[start] = 1;//标记第一个点
for (int i = 1; i <= n - 1; i++)//循环n-1次
{