#include #include #include #include #include using namespace std; struct edge { int to,cost; edge(){} edge(int t,int c) { to=t; cost=c; } }; #define P pair int n,r; vector G[5001]; int dist[5001],dist2[5001]; const int oo=1<<30; void solve() { priority_queue,greater

> que; fill(dist,dist+n,oo); fill(dist2,dist2+n,oo); dist[0]=0; que.push(P(0,0)); while(!que.empty()) { P p=que.top();que.pop(); int v=p.second,d=p.first; if(dist2[v]d2) { swap(dist[e.to],d2); que.push(make_pair(dist[e.to],e.to)); } if(dist2[e.to]>d2&&dist[e.to]