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>
using namespace std;
const int N = 1e5;
pair<int,int>p[N+5];
int c[N+5];
int main(){
int n,m;
cin >> n >> m;
for(int i = 0; i < n; i++)cin >> p[i].second >> p[i].first;
sort(p,p+n);
// for(int i = n-1; i >= 0; i--)cout << p[i].first << " " << p[i].second <<endl;
for(int i = 0; i < m; i++)cin >> c[i];
sort(c,c+m);
//for(int i = m-1; i >= 0; i--)cout << c[i] << endl;
int j = n-1;
int dem = 0;
for(int i = m-1; i >= 0; i--){
while(j >= 0 && p[j].second > c[i]){
j--;
// cout << p[i].second << " " << c[i]<<endl;
}
if(j == -1){
break;
}
else {
dem++;
j--;
//cout << endl;
}
}
cout << dem;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |