Submission #588524

#TimeUsernameProblemLanguageResultExecution timeMemory
588524webGlobal Warming (CEOI18_glo)C++17
0 / 100
88 ms3748 KiB
#include <algorithm> #include <iostream> #include <string> #include <vector> #include <queue> #include <stack> using namespace std; long lenLIS(vector<int>& v) { vector<int> lisEnds (v.size(), 0); lisEnds[0] = v[0]; int currLen = 1; for(int i=1; i<v.size(); ++i) { if(v[i] < lisEnds[0]) { lisEnds[0] = v[i]; } else if(v[i] > lisEnds[currLen-1]) { currLen++; lisEnds[currLen-1] = v[i]; } else { //find where we gotta add it auto lowB = lower_bound(lisEnds.begin(), lisEnds.begin() + currLen, v[i]); lowB--; lisEnds[lowB-lisEnds.begin()] = v[i]; } } return currLen; } int main() { long n, x; cin>>n>>x; vector<int> t(n); for(int i =0; i<n; ++i) cin>>t[i]; cout<<lenLIS(t)<<endl; }

Compilation message (stderr)

glo.cpp: In function 'long int lenLIS(std::vector<int>&)':
glo.cpp:16:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |     for(int i=1; i<v.size(); ++i)
      |                  ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...