이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define endl '\n'
#define fi first
#define se second
using namespace std;
const int MAXN=1e5+5;
const int MAXM=1e5+5;
int n,m;
pair<int,int> a[MAXN];
int b[MAXM];
int binS(int x)
{
if(x>b[1]) return 0;
int l=1,r=m+1;
while(l<r-1)
{
int mid=(l+r)/2;
if(x<=b[mid]) l=mid;
else r=mid;
}
return l;
}
bool cmpA(pair<int,int> x,pair<int,int> y)
{
if(x.se==y.se) return x.fi>y.fi;
return x.se>y.se;
}
bool cmpB(int x,int y)
{
return x>y;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin>>n>>m;
for(int i=1;i<=n;i++)
{
cin>>a[i].fi>>a[i].se;
}
for(int i=1;i<=m;i++) cin>>b[i];
sort(a+1,a+n+1,cmpA);
sort(b+1,b+m+1,cmpB);
for(int i=1;i<=n;i++)
{
a[i].fi=binS(a[i].fi);
}
int ans=0;
for(int i=1;i<=n;i++)
{
if(ans<a[i].fi) ans++;
}
cout<<ans<<endl;
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... |