#include <bits//stdc++.h>
using namespace std;
#define ll long long
#define iloop(m, h) for (auto i = m; i != h; i += (m<h?1:-1))
#define jloop(m, h) for (auto j = m; j != h; j += (m<h?1:-1))
#define pll pair<ll, ll>
#define INF 1000000000000000
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
ll n, m;
cin >> n >> m;
pll v[n];
ll a[m];
iloop(0, n) cin >> v[i].second >> v[i].first;
sort(v, v+n, greater<pll>());
iloop(0, m) cin >> a[i];
sort(a, a+m, greater<ll>());
ll ans = 0;
iloop(0, n) {
if (v[i].second <= a[ans]) ans++;
if (ans == m) break;
}
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... |