#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define MOD 998244353
void solve()
{
int n, m, ans = 0;
cin >> n >> m;
vector<vector<int>> v(n, vector<int>(2));
vector<int> c(m);
for (int i = 0; i < n; i++)
{
cin >> v[i][1] >> v[i][0];
}
for (int i = 0; i < m; i++)
{
cin >> c[i];
}
sort(v.rbegin(), v.rend());
sort(c.rbegin(), c.rend());
for (int i = 0; i < n; i++)
{
ans += (v[i][1] <= c[ans]);
}
cout << ans << '\n';
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll t = 1;
// cin >> t;
// cout << fixed << setprecision(12);
for (ll i = 1; i <= t; i++)
{
solve();
}
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |