#include <bits/stdc++.h> using namespace std; const int N=30; const int M=80; // 统计出差分系统方程组的个数不超过80个 const int K=1005; int a[N], r[N], dist[N], cnt[N], head[N]; bool vis[N]; int n, T, E; struct Edge{int v, w, ne;}e[M]; inline void add(int a, int b, int c){ e[E].v=b; e[E].w=c; e[E...