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 <bits/stdc++.h>
#define file(name) if (fopen(name".inp", "r")) { freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); }
#define FOR(i, a, b) for(int i = (a); i <= (b); ++i)
#define REV(i, b, a) for(int i = (b); i >= (a); --i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define ll long long
#define fi first
#define se second
using namespace std;
void solve(int tc) {
int n, m;
cin >> n >> m;
vector<pair<int, int>> a(n);
vector<int> c(m);
FOR(i, 0, n - 1) cin >> a[i].se >> a[i].fi;
FOR(i, 0, m - 1) cin >> c[i];
sort(a.begin(), a.end());
sort(c.begin(), c.end());
int ans = 0, j = m - 1;
for(int i = n - 1; i >= 0 && j >= 0; --i) {
if(c[j] >= a[i].se) {
++ans;
--j;
}
}
cout << ans << '\n';
return;
}
int32_t main() {
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int tc = 1;
// cin >> tc;
for(int i = 1; i <= tc; ++i) solve(tc);
return (0);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |