对于该题的建模考虑类型为二分图,即对N个点进行拆点,左边与行相连,容量为1,右边与列相连,容量为1,然后跑最大流即可 #include<iostream> #include<cstring> #include<algorithm> #include<queue> using namespace std; const int N = 1e6+10; struct Edge{ int v,next,w; }edge[N<<1]; int tot=1,head[N],S,T; const int INF = 1e9; int d[...