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;
#define pb push_back
#define fi first
#define se second
#define ll long long
const int MAX=1e5+10;
int n, m, roz[MAX];
pair<int,int>a[MAX];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
cin>>n>>m;
for(int i=1; i<=n; i++)
cin>>a[i].fi>>a[i].se;
sort(a+1, a+n+1, [](pair<int,int>x, pair<int,int>y){
if(x.se==y.se) return x.fi<y.fi;
return x.se<y.se;
});
for(int i=1; i<=m; i++)
cin>>roz[i];
sort(roz+1, roz+m+1);
int ile=0, licz=n;
for(int i=m; i>=1; i--){
while(licz>=1 && a[licz].fi>roz[i])
licz--;
if(licz>=1 && a[licz].fi<=roz[i])
ile++;
licz--;
}
cout<<ile<<"\n";
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |