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 all(x) begin(x), end(x)
#define sz(x) int((x).size())
#define eb emplace_back
#define pb push_back
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
const int MN = 1e5 + 5;
int N, M, c[MN];
int main() {
ios_base::sync_with_stdio(0), cin.tie(0);
cin >> N >> M;
vector<pii> a;
for (int i = 0; i < N; i++) {
int s, v; cin >> s >> v;
a.eb(v, s);
}
for (int i = 0; i < M; i++) cin >> c[i];
sort(all(a));
sort(c, c + N);
int ans = 0;
for (int i = N - 1; i >= 0 && ans < M; i--) {
if (c[M - 1 - ans] >= a[i].second) ans++;
}
cout << ans << '\n';
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... |