Submission #1039698

#TimeUsernameProblemLanguageResultExecution timeMemory
1039698tamir1Exhibition (JOI19_ho_t2)C++17
100 / 100
120 ms4652 KiB
#include<bits/stdc++.h> #define ff first #define ss second using namespace std; int n,m,c[100005],i,j,ans; pair<int,int> p[100005]; bool cmp(pair<int,int> a,pair<int,int> b){ if(a.ss==b.ss) return a.ff<b.ff; return a.ss<b.ss; } int main(){ cin >> n >> m; for(i=1;i<=n;i++){ cin >> p[i].ff >> p[i].ss; } for(i=1;i<=m;i++){ cin >> c[i]; } sort(p+1,p+n+1,cmp); sort(c+1,c+m+1); j=n; for(i=m;i>=1;i--){ while(c[i]<p[j].ff) j--; if(j>0) ans++; else break; j--; } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...