Submission #590636

#TimeUsernameProblemLanguageResultExecution timeMemory
590636karriganExhibition (JOI19_ho_t2)C++14
100 / 100
60 ms4456 KiB
#include<bits/stdc++.h> #define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr); using namespace std; struct lena{ int c,w; }a[6000001]; bool cmp(const lena &p, const lena &q){ return ((p.c>q.c)||(p.c==q.c&&p.w>q.w)); } int b[6000001]; int main() { fastio //freopen(".INP","r",stdin); //freopen(".OUT","w",stdout); int n,m; cin>>n>>m; for (int i=1;i<=n;i++){ cin>>a[i].w>>a[i].c; } sort(a+1,a+1+n,cmp); for (int i=1;i<=m;i++){ cin>>b[i]; } sort(b+1,b+1+m,greater<int>()); int j=1; int cnt=0; for (int i=1;i<=n;i++){ if (j==m+1)break; if (b[j]>=a[i].w){ cnt++; j++; } //else j++; } cout<<cnt; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...