/*
Author : detective conan
Problem : Exhibition
Created : 09:08 UTC+7
*/
#include <bits/stdc++.h>
#define int long long
#define FOR(i, s, t) for(int i = s; i <= t; ++i)
#define rep(i, s, t) for(int i = s; i >= t; --i)
#define HAVE_TESTCASE false
#define conan cin.tie(nullptr)->sync_with_stdio(false)
#define mod (int)(1e9 + 7)
#define vec vector
#define pii pair<int, int>
#define ari(n) array<int, n>
#define pb push_back
#define eb emplace_back
#define ph push
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define ANS(n, s) cout << n << s
using namespace std;
using u32 = unsigned;
using i64 = int64_t;
using u64 = unsigned i64;
const int MAX_N = 1e5 + 10, MAX_M = 1e5 + 10;
int s, v, c[MAX_M], n, m, ans;
vec<pii> vc;
void solve(){
cin >> n >> m;
FOR(i, 1, n) cin >> s >> v, vc.eb(v, s);
FOR(i, 1, m) cin >> c[i];
sort(c + 1, c + 1 + m, greater<int>());
sort(vc.begin(), vc.end(), greater<pii>());
int l = 0, r = 1;
while(l < n && r <= m){
if(c[r] >= vc[l].second){
r++;
ans++;
}
l++;
}
ANS(ans, '\n');
}
int32_t main(){
conan;
int t = 1;
if(HAVE_TESTCASE) cin >> t;
while(t--) 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... |