#include<cstdio> #include<cstring> #include<algorithm> usingnamespacestd; constint maxn=30009; constint maxm=150009; constlonglong inf=10000000000000000LL; typedeflonglong ll; int head[maxn]; int ver[maxm]; int next[maxm]; int e[maxm]; int tot=1; bool vis[maxn]; ll d[maxn]; int n,m; int s; int q[10000000],top;