This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define int long long
//#define double long double
#define Nanase_Kurumi_aka_menhera_chan_is_mine ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define pi pair<int, int>
#define ALL(i) i.begin(),i.end()
#define gcd(i,j) __gcd(i,j)
#define fi first
#define se second
#define eps 0.00000001
#define ist insert
#define DNE nullptr
//#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
//#pragma GCC optimize("O2")
int max(int x,int y){return x>=y?x:y;}
int min(int x,int y){return x>=y?y:x;}
using namespace std;
typedef int ll;
const int N=100005;
const int M=1000005;
const int MOD=1000000007;//998244353;
const int INF=1000000000000000000;//2147483647;
pi a[N];
int c[N],bit[N];
int n,m;
vector<int> LDS;
int get(int v){
int l=0,r=LDS.size()-1,res=-1;
while (r>=l){
int md=(l+r)/2;
if (LDS[md]<=v){
res=md;
r=md-1;
}
else l=md+1;
}
return res;
}
inline void sol(){
cin >>n>>m;
for (int i=1;i<=n;i++)
cin >>a[i].se>>a[i].fi;
for (int j=0;j<m;j++)
cin >>c[j];
sort(a+1,a+n+1,[](pi l,pi r){
return l.fi==r.fi?l.se>r.se:l.fi>r.fi;
});
//for (int i=1;i<=n;i++)
//cout <<a[i].fi<<' '<<a[i].se<<'\n';
sort(c,c+m,greater<int>());
int j=0;
for (int i=1;i<=n;i++)
if (a[i].se<=c[j]){
j++;
}
cout <<j<<'\n';
}
signed main(){
Nanase_Kurumi_aka_menhera_chan_is_mine
int _=1;
//cin >>_;
while (_--) sol();
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... |