Submission #1008534

#TimeUsernameProblemLanguageResultExecution timeMemory
1008534ihneExhibition (JOI19_ho_t2)C++17
0 / 100
2 ms4700 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; } }; 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; }

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'std::istream& operator>>(std::istream&, pt&)':
joi2019_ho_t2.cpp:17:3: warning: no return statement in function returning non-void [-Wreturn-type]
   17 |   }
      |   ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...