题目链接:Codeforces 468B Two Sets
题目大意:给出n个数,要求将n个数分配到两个集合中,集合0中的元素x,要求A-x也再0中,同理1集合。
解题思路:类似二分图匹配的方法。
#include <cstdio>
#include <cstring>
#include <map>
#include <stack>
#include <algorithm>
using namespace std;
const int maxn = 1e5 + 5;
int N, A, B, x[maxn], v[maxn], r = 0;
map<int, int> G;
bool match (int a, int M, int k) {
int p = G[a];
if (!G.count(M - a))
return fal......
阅读全文