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;
typedef long long ll;
typedef pair<ll,ll> pll;
//#define int ll
#define MottoHayaku ios::sync_with_stdio(0);cin.tie(0);
#define F first
#define S second
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define pb push_back
#define uni(c) c.resize(distance(c.begin(),unique(c.begin(),c.end())))
#define unisort(c) sort(c.begin(),c.end());uni(c);
signed main()
{
MottoHayaku
ll n,m;
cin>>n>>m;
vector<pll> v(n);
vector<ll> c(m);
rep(i,n) cin>>v[i].S>>v[i].F;
rep(i,m) cin>>c[i];
sort(v.begin(),v.end());
sort(c.begin(),c.end());
ll cur=n-1,ans=0;
for(int i=m-1;i>=0;i--)
{
while(cur>=0&&v[cur].S>c[i]) cur--;
if(cur<0) break;
ans++;
cur--;
}
cout<<ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |