EK + dijkstra (2246ms) 开氧气(586ms) dijkstra的势 可以处理负权 https://www.luogu.org/blog/28007/solution-p3381 #include <bits/stdc++.h> using namespace std; const int INF = 1e9; int n, m, s, t, cnt; struct node { int to, nex, val, cost; }E[100005]; int head[5…
记得把数组开大一点,不然就RE了... 1 #include<bits/stdc++.h> 2 using namespace std; 3 #define int long long 4 const int N=5e5; 5 const int M=5e5; 6 const int INF=0x3f3f3f3f; 7 8 int n,m,s,t,ans,d[N],maxflow; 9 int tot=1,adj[N],nex[M],to[M],cap[M],cost[M]; 10 bool…