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 ii pair<int, int>
#define fi first
#define se second
#define inf 0x3f3f3f3f3f3f3f3f
using namespace std;
using ll = long long;
const ll mod=1e9+7;
const int nx=1e5+5;
int n, m, f[nx], lim[nx], d, c, g, ans;
ii a[nx];
bool cmp(ii a, ii b)
{
if(a.se==b.se)
return a.fi>b.fi;
return a.se>b.se;
}
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].fi>>a[i].se;
sort(a+1, a+n+1, cmp);
for(int i = 1; i <= m; i++)
cin>>f[i];
sort(f+1, f+m+1, greater<int>());
ans=1;
for(int i = 1; i <= n; i++)
if(a[i].fi<=f[ans])
ans++;
cout<<ans-1;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |