#include <bits/stdc++.h> using namespace std; const int maxn = 1e3; struct Edge { int to,w,next; }edge[maxn]; int head[maxn], cnt = 0; void add_edge(int u, int to, int w) { edge[cnt].to = to; edge[cnt].w = w; edge[cnt].next = head[u]; head[u] = cnt++; } int card[maxn]={},dis[maxn],visNode[maxn...