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 ll long long
#define fi first
#define se second
ll m,n,k,tong;
struct picture
{
int s,v;
} a[100005];
ll frame[100005];
bool cmp(picture x,picture y)
{
if (x.v==y.v) return x.s<y.s;
return x.v<y.v;
}
main()
{
ios_base::sync_with_stdio(false); cin.tie(NULL);
cin>>n>>m;
for (int i=1;i<=n;++i)
{
cin>>a[i].s>>a[i].v;
}
for (int i=1;i<=m;++i) cin>>frame[i];
sort(frame+1,frame+m+1);
sort(a+1,a+n+1,cmp);
k=m;
for (int i=n;i>=1;--i)
{
if (k!=0 && a[i].s<=frame[k])
{
tong++;
k--;
}
}
cout<<tong;
}
Compilation message (stderr)
joi2019_ho_t2.cpp:17:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
17 | main()
| ^~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |