Submission #968833

#TimeUsernameProblemLanguageResultExecution timeMemory
968833vjudge1Global Warming (CEOI18_glo)C++17
Compilation error
0 ms0 KiB
#include<iostream> #include<vector> #include<algorithm> using namespace std; vector<int> dp; int lis(int tt[],int n,int a,int b,int x){ int t[n+1]; for(int i=1;i<=n;++i) t[i]=tt[i]; for(int i=a;i<=b;++i){ t[i]+=x; } dp.clear(); for(int i=1;i<=n;++i){ int idx=lower_bound(dp.begin(),dp.end(),t[i])-dp.begin(); if(idx==dp.size()) dp.push_back(t[i]); else dp[idx]=t[i]; } return dp.size(); } int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n,x; cin >> n >> x; int t[n+1]; for(int i=1;i<=n;++i) cin >> t[i]; int maxi=0; for(int e=s;e<=n;++e){ //cout << s << " " << e << " " << p << " " << lis(t,n,s,e,p) << endl; maxi=max(lis(t,n,1,e,-abs(x)),maxi); } cout << maxi; }

Compilation message (stderr)

glo.cpp: In function 'int lis(int*, int, int, int, int)':
glo.cpp:17:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |         if(idx==dp.size()) dp.push_back(t[i]);
      |            ~~~^~~~~~~~~~~
glo.cpp: In function 'int main()':
glo.cpp:28:15: error: 's' was not declared in this scope
   28 |     for(int e=s;e<=n;++e){
      |               ^