#include <iostream> #include <cstring> using namespace std; const int N = 20010,M = 200010; int q[2 * M], hh = 0, tt = -1; //数组模拟队列 bool vis[N]; //判断是否已经在对立中 int dis[N]; int n, m; int h[N], e[M], ne[M], w[M], idx; void add(int a,int b, int wei) //添加一条有向边 { e[idx] = b, w[idx] = wei...