P3440 [POI2006]SZK-Schools
题目链接 题解: 暴力连边,然后直接最小费用最大流就OK了 AC代码: # pragma GCC optimize(2) # include <bits/stdc++.h> # include <ext/rope> using namespace std ; using namespace __gnu_cxx ; # define LL long long const int MAXN = 2000 + 50 ; const int MAXM = 2e6 + 50 ; const int MOD = 1e9 + 7 ; const int INF = 0x3f3f3f3f ; int n , m , s , t , tot = 1 , maxflow , res , head [ MAXN ] , nxt [ MAXM ] , w [ MAXM ] , to [ MAXM ] , co [ MAXM ] ; int dis [ MAXN ] , vis [ MAXN ] , pre [ MAXN ] , flow [ MAXN ] ; inline void ade ( int u , int v , int ww , int cost ) { to [ ++ tot ] = v ; w [ tot ] = ww ; co [ tot ] = cost ; nxt [ tot ]