# 牛客练习赛24---E

感觉可能有更好的方法？想到的是构图，因为n和m都很小，因此每两个点之间都可以建一条边，然后传送点之间再多建一条权值为1的边。然后跑dijkstra算法就可以找到最短路了。

#include <bits/stdc++.h>
#define sc1(a) scanf("%d",&a)
#define sc2(a,b) scanf("%d%d",&a,&b)
#define sc3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define sc4(a,b,c,d) scanf("%d%d%d%d",&a,&b,&c,&d)
using namespace std;
typedef long long LL;
typedef pair<int,int> pi;
const int maxn = 1e5 + 10;
const int maxx = maxn*2;
struct node {
int to,nex,w;
}edge[maxx];
int cnt,n,m,w;
edge[cnt].to = v;
edge[cnt].w = w;
}
void dijkstra(int s,int dis[]){
priority_queue<pi> pq;
for (int i=0; i<=m; i++)
dis[i] = 99999999;
dis[s] = 0;
pq.push(make_pair(0,s));
while (!pq.empty()) {
pi now = pq.top();pq.pop();
int u = now.second;
for (int i=head[u]; ~i; i=edge[i].nex) {
int v = edge[i].to;
//cout << u << ' ' << v << ' ' << edge[i].w  << ' '<< dis[v] << endl;
if (dis[v] > dis[u] + edge[i].w){
dis[v] = dis[u] + edge[i].w;
pq.push(make_pair(dis[v],v));
}
}
}
}
int main(){
sc2(m, n);
for (int i=0; i<n; i++) {
scanf("%d%d",&u[i],&v[i]);
}
for (int i=0; i<=m; i++) {
for (int j=0; j<=m; j++) {
if (i != j){