Submission #1030249

#TimeUsernameProblemLanguageResultExecution timeMemory
1030249vjudge1Exhibition (JOI19_ho_t2)C++17
0 / 100
0 ms600 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define pii pair<int, int> #define pll pair<ll, ll> #define pld pair<ld, ld> #define pb push_back #define fi first #define se second #define debug(x) cout << #x << " => " << x << endl #define all(x) x.begin(),x.end() int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n,m;cin>>n>>m; pii a[n]; int b[m]; for(int i=0;i<n;i++) cin>>a[i].se>>a[i].fi; for(int i=0;i<m;i++) cin>>b[i]; sort(a,a+n); sort(b,b+m); vector<pii> v; for(int i=0;i<n;i++) { int x=lower_bound(b,b+m,a[i].se)-b; pii p={a[i].se,x}; int y=lower_bound(all(v),p)-v.begin(); if(y==v.size()) { if(y-1>=0) x=max(x,v[y-1].se+1); if(x!=m) v.pb({a[i].se,x}); } else if(v[y]==p) { p={a[i].se,1e9}; y=upper_bound(all(v),p)-v.begin(); if(y==v.size()) { if(y-1>=0) x=max(x,v[y-1].se+1); if(x!=m) v.pb({a[i].se,x}); } else { if(y-1>=0) x=max(x,v[y-1].se+1); if(x!=m) v[y]={a[i].se,x}; } } else { if(y-1>=0) x=max(x,v[y-1].se+1); if(x!=m) v[y]={a[i].se,x}; } // for(auto j : v) cout<<j.fi<<' '<<j.se<<'\n';cout<<'\n'; } cout<<v.size(); return 0; }

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:32:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |   if(y==v.size())
      |      ~^~~~~~~~~~
joi2019_ho_t2.cpp:41:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |       if(y==v.size())
      |          ~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...