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
#define int long long
using namespace std;
const int N = 1005;
int n, m;
pair<int, int> a[N];
int c[N];
void solve(int tc) {
cin >> n >> m;
FOR(i, 1, n) cin >> a[i].se >> a[i].fi;
FOR(i, 1, m) cin >> c[i];
sort(a + 1, a + n + 1);
sort(c + 1, c + m + 1);
int ans = 0, j = m;
for(int i = n; i >= 1 && j >= 1; --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... |