摘要:
网络流 如果只有两个的话就是裸的二分图匹配 然而这里有三个元素 由于食物和饮料互相没有关系,只和牛有关系 那么我们把牛拆点x->y cap = 1 然后饮料和食物分别限制x y就行了 #include<bits/stdc++.h> using namespace std; const int N = 阅读全文
摘要:
线段树 线段树记录到每个位置截止的答案 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e6 + 5; int n, m; ll ans; int nxt[N], last[N], a 阅读全文