Submission #995466

#TimeUsernameProblemLanguageResultExecution timeMemory
995466SuPythonyExhibition (JOI19_ho_t2)C++17
0 / 100
1 ms348 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n,m; cin>>n>>m; vector<pair<int,int>> a; for (int i=0; i<n; i++) { int s,v; cin>>s>>v; a.push_back({v,s}); } vector<int> c(m); for (auto &i: c) cin>>i; sort(a.begin(),a.end()); sort(c.begin(),c.end()); vector<int> s; for (auto i: a) s.push_back(i.second); vector<int> lbs; for (int i=0; i<n; i++) { auto p=lower_bound(c.begin(),c.end(),s[i]); if (p==c.end()) continue; lbs.push_back(p-c.begin()); } vector<int> l; int mn; for (int i=0; i<lbs.size(); i++) { auto p=upper_bound(l.begin(),l.end(),lbs[i]); if (p==l.end()) { l.push_back(lbs[i]); mn=lbs[0]; } else { *p=lbs[i]; } } cout<<min(m-mn,(int)l.size()); }

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:26:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |     for (int i=0; i<lbs.size(); i++) {
      |                   ~^~~~~~~~~~~
joi2019_ho_t2.cpp:35:16: warning: 'mn' may be used uninitialized in this function [-Wmaybe-uninitialized]
   35 |     cout<<min(m-mn,(int)l.size());
      |               ~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...