裸最短路.. ------------------------------------------------------------------------------------ #include<cstdio> #include<cstring> #include<algorithm> #include<iostream> #include<queue> #define rep( i , n ) for( int i = 0 ; i &…
因为是双向边,所以相当于两条到1的最短路和,先跑spfa然后直接处理询问即可 #include<iostream> #include<cstdio> #include<queue> using namespace std; const int N=50005,inf=1e9; int n,m,b,h[N],cnt,dis[N]; bool v[N]; struct qwe { int ne,to,va; }e[N<<2]; int read() { int…