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>
#define ll long long
#define f first
#define s second
const int N=1e5+10;
using namespace std;
int n,m,sz[N];
pair<int,int>a[N];
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n>>m;
for(int i=1; i<=n; i++) cin>>a[i].s>>a[i].f;
for(int i=1; i<=m; i++) cin>>sz[i];
sort(a+1,a+n+1);
sort(sz+1,sz+m+1,greater<int>());
int run=n,kq=0;
for(int i=1; i<=m; i++)
{
while(run>0&&a[run].s>sz[i]) run--;
if(!run) return cout<<kq,0;
run--;
kq++;
}
cout<<kq;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |