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>
using namespace std;
#define int long long
#define endl '\n'
int n, m;
vector<int> vi;
vector<pair<int, int>> v;
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m;
for (int i = 0; i < n; i++) {
int a, b; cin >> b >> a;
v.push_back({a, b});
}
for (int i = 0; i < m; i++) {
int x; cin >> x;
vi.push_back(x);
}
sort(v.begin(), v.end());
sort(vi.begin(), vi.end());
int i = n - 1, j = m - 1;
int ans = 0;
while (i >= 0 && j >= 0) {
while (i >= 0 && vi[j] < v[i].second) i--;
if (i < 0) break;
ans++;
j--;
i--;
}
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... |