Submission #538431

#TimeUsernameProblemLanguageResultExecution timeMemory
538431__VariattoExhibition (JOI19_ho_t2)C++17
100 / 100
57 ms4456 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define fi first #define se second #define ll long long const int MAX=1e5+10; int n, m, roz[MAX]; pair<int,int>a[MAX]; int main(){ ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0); cin>>n>>m; for(int i=1; i<=n; i++) cin>>a[i].fi>>a[i].se; sort(a+1, a+n+1, [](pair<int,int>x, pair<int,int>y){ if(x.se==y.se) return x.fi<y.fi; return x.se<y.se; }); for(int i=1; i<=m; i++) cin>>roz[i]; sort(roz+1, roz+m+1); int ile=0, licz=n; for(int i=m; i>=1; i--){ while(licz>=1 && a[licz].fi>roz[i]) licz--; if(licz>=1 && a[licz].fi<=roz[i]) ile++; licz--; } cout<<ile<<"\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...