//#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define X first
#define Y second
int n;int m;
pair<int,int>paint[500005];
int buc[500005];
int ok(int mi){
int it=m-mi+1;
for(int i=1;i<=n;i++){
if(buc[it]>=paint[i].second){
it++;
if(it==m+1){return 1;}
}
}
return 0;
}
signed main(){
cin>>n>>m;
for(int i=1;i<=n;i++){
cin>>paint[i].second>>paint[i].first;
}
sort(paint+1,paint+n+1);
for(int i=1;i<=m;i++){
cin>>buc[i];
}
sort(buc+1,buc+m+1);
int l=0;int r=m;
while(l<r){
int mi=l+(r-l)/2;
if(ok(mi)){
l=mi;
}else{
r=mi-1;
}
}
cout<<l<<endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Execution timed out |
1073 ms |
308 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Execution timed out |
1073 ms |
308 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Execution timed out |
1073 ms |
308 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |