Submission #564787

#TimeUsernameProblemLanguageResultExecution timeMemory
564787groshiExhibition (JOI19_ho_t2)C++17
100 / 100
64 ms4928 KiB
#include<iostream> #include<utility> #include<algorithm> #include<vector> using namespace std; vector<int> Q2; vector<pair<int,int> > Q; int n; bool sprawdz(int x) { int gdzie=0; for(int i=Q2.size()-x;i<Q2.size();i++) { while(gdzie<n && Q[gdzie].second>Q2[i]) gdzie++; if(gdzie>=n) return 0; gdzie++; } return 1; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int m,x,y; cin>>n>>m; for(int i=1;i<=n;i++) { cin>>x>>y; Q.push_back({y,x}); } for(int i=1;i<=m;i++) { cin>>x; Q2.push_back(x); } sort(Q.begin(),Q.end()); sort(Q2.begin(),Q2.end()); int pocz=0,kon=m+1,sre,ostd=0; while(pocz<kon) { sre=(pocz+kon)/2; if(sprawdz(sre)) { ostd=sre; pocz=sre+1; } else kon=sre; } cout<<ostd; return 0; }

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'bool sprawdz(int)':
joi2019_ho_t2.cpp:12:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     for(int i=Q2.size()-x;i<Q2.size();i++)
      |                           ~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...