#include<bits/stdc++.h>
using namespace std;
#define task "a"
#define se second
#define fi first
#define ll long long
#define ii pair<ll, ll>
const long mxN = 1e5 + 7;
int n, m;
ii a[mxN];
int sz[mxN];
priority_queue<ii, vector<ii>, less<ii>> pq;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
//freopen(task".INP", "r", stdin);
//freopen(task".OUT", "w", stdout);
cin >> n >> m;
for (int i = 1; i <= n; i++)
{
cin >> a[i].se >> a[i].fi;
pq.push(a[i]);
}
for (int i = 1; i <= m; i++)
cin >> sz[i];
sort(sz + 1, sz + m + 1, greater<int>());
int ans = 0;
for (int i = 1; i <= m; i++)
{
while (pq.size() && pq.top().se > sz[i])
pq.pop();
if (pq.empty())
break;
pq.pop();
ans++;
}
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... |