이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define fi first
#define se second
#define pitem item*
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
const int N=1e6+10;
pair<int,int> t[N];
int t2[N];
int n,m;
int bs(int x){
int pocz=1,kon=m,sr,res=-1;
while(pocz<=kon){
sr=(pocz+kon)>>1;
if(t2[sr]>=x) res=sr,kon=sr-1;
else pocz=sr+1;
}
return res;
}
void solve(){
cin>>n>>m;
for(int i=1;i<=n;i++) cin>>t[i].se>>t[i].fi;
sort(t+1,t+1+n);
for(int i=1;i<=m;i++) cin>>t2[i];
sort(t2+1,t2+1+m);
int maxi=0;
for(int i=n;i>=1;i--){
int g=bs(t[i].se);
if(g==-1) continue;
g=m-g+1;
g=min(g,maxi+1);
maxi=max(maxi,g);
}
cout<<maxi<<"\n";
}
int main(){
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... |