这实际上是一棵树,拓扑排序一下,关键点的流量是所有出水口的数目之和
#define ll int
#define vec vector<ll>
#define inf 0x3f3f3f3f
#define MAX 100005
int n, u, v, ind[MAX], flow[MAX];
vec G[MAX];
int main() {
while (cin >> n) {
memset(ind, 0, sizeof(ind));
memset(flow, 0, sizeof(flow));
for (in...