This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//#pragma GCC optimize("O3,Ofast,unroll-loops,no-stack-protector")
//#pragma GCC target("avx2")
#include <bits/stdc++.h>
#include <bits/extc++.h>
#define int long long
#define double long double
using namespace std;
using namespace __gnu_pbds;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
#define sz(x) x.size()
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define mp make_pair
#define UNTIEIO ios::sync_with_stdio(0),cin.tie(0);
int n,m;
signed main(){
UNTIEIO;
cin >> n >> m;
vi c(m);
vector<pii> p(n);
for(int i=0;i<n;i++) cin >> p[i].second >> p[i].first;
for(int i=0;i<m;i++) cin >> c[i];
sort(all(p));
sort(all(c));
int now=n-1,ans=0;
for(int i=m-1;i>=0;i--){
while(now>=0 && p[now].second>c[i]) now--;
if(now>=0){
ans++;
now--;
}
}
cout << ans << "\n";
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |