Submission #731670

#TimeUsernameProblemLanguageResultExecution timeMemory
731670ToxtaqGlobal Warming (CEOI18_glo)C++17
15 / 100
2068 ms2576 KiB
#include<bits/stdc++.h> using namespace std; int main() { int n, x, res = 0; cin >> n >> x; vector<int>t(n); for(int i = 0;i < n;++i)cin >> t[i]; for(int i = -x;i <= x;++i){ for(int l = 0;l < n;++l){ vector<int>modif; modif = t; for(int r = l;r < n;++r){ modif[r] += i; vector<int>tempo; for(int k = 0;k < n;++k){ int pos = lower_bound(tempo.begin(), tempo.end(), modif[k]) - tempo.begin(); if(pos == tempo.size())tempo.push_back(modif[k]); else tempo[pos] = modif[k]; } res = max(res, (int)tempo.size()); } } } cout << res; }

Compilation message (stderr)

glo.cpp: In function 'int main()':
glo.cpp:18:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |                     if(pos == tempo.size())tempo.push_back(modif[k]);
      |                        ~~~~^~~~~~~~~~~~~~~
#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...