Submission #1008536

#TimeUsernameProblemLanguageResultExecution timeMemory
1008536ihneExhibition (JOI19_ho_t2)C++17
100 / 100
36 ms5788 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define fi first #define se second #define pii pair<int,int> #define pb push_back const int mn=1e5+5; struct pt{ int s,v; bool operator < (const pt &o) const{ if (v!=o.v)return v<o.v; return s<o.s; } friend istream& operator >> (istream& in,pt& p){ in>>p.s>>p.v; return in; } }; pt p[mn]; int f[mn]; signed main(){ //freopen("","r",stdin); //freopen("","w",stdout); ios_base::sync_with_stdio(0); cin.tie(0); int n,m; cin>>n>>m; for (int i=1;i<=n;i++){ cin>>p[i]; } for (int i=1;i<=m;i++){ cin>>f[i]; } sort(p+1,p+n+1); sort(f+1,f+m+1); int it=n; int ans=0; for (int i=m;i>=1;i--){ while (it&&p[it].s>f[i]) it--; if (!it) break; if (p[it].s<=f[i]) ans++; it--; } cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...