首页 > TAG信息列表 > 1139E
Maximize Mex CodeForces - 1139E(思维)(二分图理解)
There are n students and m clubs in a college. The clubs are numbered from 1 to m. Each student has a potential pi and is a member of the club with index ci. Initially, each student is a member of exactly one club. A technical fest starts in the college,Codeforces 1139E(二分图最大匹配)
pi只有0~5000且只找最小的没出现的,又要找不同club的,考虑二分匹配,左边pi,右边ci,一个匹配一个。离线倒着加边即可。 const int maxn = 5e3 + 5; int m, n, d, now; int P[maxn], C[maxn], K[maxn]; int match[maxn], ans[maxn]; bool mark[maxn], used[maxn]; vector<int> G[maxn]; boCodeforces 1139E Maximize Mex 二分图匹配
Maximize Mex 离线之后把删数变成加数, 然后一边跑匈牙利一遍算答案。 #include<bits/stdc++.h>#define LL long long#define fi first#define se second#define mk make_pair#define PLL pair<LL, LL>#define PLI pair<LL, int>#define PII pair<int, int>#define SZ(x) ((in