Submission #98206

#TimeUsernameProblemLanguageResultExecution timeMemory
98206scanhexExhibition (JOI19_ho_t2)C++17
100 / 100
97 ms2056 KiB
#include <bits/stdc++.h> using namespace std; using nagai = long long; #define sz(x) int((x).size()) const int N=100100; int s[N],v[N],c[N]; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n,m; cin>>n>>m; vector<int>ord1(n); for(int i=0;i<n;++i) cin>>s[i]>>v[i]; for(int i=0;i<m;++i)cin>>c[i]; iota(ord1.begin(),ord1.end(),0); sort(ord1.begin(),ord1.end(),[&](int a,int b){ if(v[a]!=v[b]) return v[a]<v[b]; return s[a]<s[b]; }); sort(c,c+m); int ans=0; int cur=n-1; for(int i=m-1;i>=0;--i){ while(cur>=0&&s[ord1[cur]]>c[i])--cur; if(cur>=0)++ans,--cur; } cout<<ans<<'\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...