Lang:G++
Edit12345678910111213141516171819202122232425262728293031#include <iostream>#include <vector>#include <cstring>#include <queue>using namespace std;int N, M, K, Q;typedef struct{int f, t, next, w;}Edge;Edge edge[1000005];int head[510000];bool visit[510000];int dist[510000];int kNum;void addedge(int f, int t, int w){edge[kNum].f = f;edge[kNum].t = t;edge[kNum].w = w;edge[kNum].next = head[f];head[f] = kNum ++;edge[kNum].f = t;edge[kNum].t = f;edge[kNum].w = w;edge[kNum].next = head[t];head[t] = kNum ++;}