text: Example Input 3 5 2 5 3 7 0 5 0 4 0 10 0 2 1 10 100 50 10 5 5 1 5 2 4 3 3 4 2 5 1 Output 4 2 1 -1 5 1 2 5 5 4 3 2 1 Note Consider the example test.In the first test case, Polycarp can summon the minion 2 with power level 7, then summon the minion 1, which will increase the power level of the previous minion by 3, then destroy the minion 1, and finally, summon the minion 5.After this, Polycarp will have two minions with power levels of 10.In the second test case, Polycarp can control only one minion, so he should choose the strongest of them and summon it.In the third test case, Polycarp is able to summon and control all five minions.# Solution #include <bits/stdc++.h> using namespace std; struct Edge { long long to, dis, next, cost; } edge[24050]; long long num = -1; bool vis[10010]; long long mincost; long long pre[10010], head[10010], cost[10010], last[10010], flow[10010], n, k, a[110], b[110], s, t, maxflow; long long to[110]; void add(long long f, long long t, long long dis, long long cost) { edge[++num].to = t; edge[num].dis = dis; edge[num].next = head[f]; edge[num].cost = cost; head[f] = num; edge[++num].to = f; edge[num].dis = 0; edge[num].cost = -cost; edge[num].next = head[t]; head[t] = num; } queue<long long> q; bool spfa(long long s, long long t) { memset(cost, 0x3f3f3f3f, sizeof cost); memset(flow, 0x3f3f3f3f, sizeof flow); memset(vis, 0, sizeof vis); q.push(s); vis[s] = 1; cost[s] = 0; pre[t] = -1; while (!q.empty()) { long long nowp = q.front(); q.pop(); vis[nowp] = 0; for (long long i = head[nowp]; i != -1; i = edge[i].next) { if (edge[i].dis > 0 && cost[edge[i].to] > cost[nowp] + edge[i].cost) { cost[edge[i].to] = cost[nowp] + edge[i].cost; pre[edge[i].to] = nowp; last[edge[i].to] = i; flow[edge[i].to] = min(flow[nowp], edge[i].dis); if (!vis[edge[i].to]) { vis[edge[i].to] = 1; q.push(edge[i].to); } } } } return pre[t] !