#include <bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define inf INT_MAX
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FAR(i, a, b) for (int i = (a); i >= (b); i--)
#define all(x) (x.begin(), x.end())
const int MOD = 1e9 + 7;
using namespace std;
bool comp(pair<int, int> a, pair<int, int> b)
{
if (a.ss <= b.ss)
return 1;
else
return 0;
}
int main()
{
int n, m, ans = 0;
cin >> n >> m;
vector<pair<int, int>> v;
int c[m];
for (int i = 0; i < n; i++)
{
int x, y;
cin >> x >> y;
v.push_back({y, x});
}
for (int i = 0; i < m; i++)
cin >> c[i];
sort(v.begin(), v.end());
sort(c, c + m);
for (int i = 0, j = 0; i < n && j < m;)
{
if (v[i].ss <= c[j])
{
i++;
j++;
ans++;
}
else
j++;
}
cout << ans << endl;
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... |