This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <cstdio>
#include <algorithm>
#define fi first
#define se second
using namespace std;
const int N = 100005, M = 100005;
int n, m, ans = 0, c[M];
pair<int, int> a[N];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n >> m;
for (int i = 1; i <= n; i++)
cin >> a[i].se >> a[i].fi;
for (int i = 1; i <= m; i++)
cin >> c[i];
sort(a + 1, a + n + 1, greater<pair<int, int>>());
sort(c + 1, c + m + 1, greater<int>());
for (int i = 1; i <= n; i++)
ans = max(ans, min(ans + 1, (int)distance(c + 1, upper_bound(c + 1, c + m + 1, a[i].se, greater<int>()))));
cout << ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |