Codeforces Round 942 (Div. 2)
传送门
被新生省队爷n+2了,回想起来,d2也能做,可惜我没坚持推下去。
A. Contest Proposal
这题看了本蒟蒻好久,16分钟才解决。
解决办法,贪心,排序完成,将每个已经出了的题匹配到他最适合的难度。
代码:
#include <bits/stdc++.h>
using namespace std;
#define N 200005
#define endl '\n'
#define int long long
int T, n, ans, a[N], b[N], c[N];
map<int, int> vis;
void solve()
{
cin >> n;
vis.clear();
ans = 0;
for (int i = 1; i <= n; i++)
cin >> a[i];
for (int i = 1; i <= n; i++)
cin >> b[i];
sort(a + 1, a + 1 + n);
sort(b + 1, b + 1 + n);
int l = 1, r = 1;
while (l <= n && r <= n)
{
if (a[l] <= b[r])
{
ans++;
l++;
}
r++;
}
cout << n - ans << endl;
}
signed main()
{
cin >> T;
while (T--)
so