Submission #542834

#TimeUsernameProblemLanguageResultExecution timeMemory
542834FystyExhibition (JOI19_ho_t2)C++17
100 / 100
66 ms5604 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...