#include <bits/stdc++.h>
// Author: Kazuki_Will_Win_VOI_8703
#define fi first
#define se second
#define pii pair<int, int>
#define int long long
#define all(a) a.begin(), a.end()
using namespace std;
const int mn = 2e5 + 5, bm = (1 << 11) + 1, mod = 1e9 + 7, offset = 5e4;
const int inf = 1e18, base = 311;
int n, m, c[mn];
struct Megumi{
int s, v;
bool operator<(const Megumi& other){
if(v == other.v) return s < other.s;
return v < other.v;
}
} e[mn];
void solve(){
cin >> n >> m;
for(int i = 1; i <= n; i++) cin >> e[i].s >> e[i].v;
sort(e + 1, e + n + 1);
for(int i = 1; i <= m; i++) cin >> c[i];
sort(c + 1, c + m + 1);
int ptr = m, res = 0;
for(int i = n; i >= 1; i--){
if(ptr >= 1 && e[i].s <= c[ptr]){
ptr --;
res ++;
}
}
cout << res << '\n';
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t = 1;
// 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... |