Submission #1103952

#TimeUsernameProblemLanguageResultExecution timeMemory
1103952vjudge1Global Warming (CEOI18_glo)C++17
38 / 100
2064 ms3132 KiB
#include<iostream> #include<vector> #include<algorithm> using namespace std; vector<int> dp; int lis(int t[],int n,int a,int b,int x){ dp.clear(); int cur; for(int i=1;i<=n;++i){ cur=t[i]+x*(i<=b); int idx=lower_bound(dp.begin(),dp.end(),cur)-dp.begin(); if(idx==dp.size()) dp.push_back(cur); else dp[idx]=cur; } 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; if(x==0){ cout << lis(t,n,0,0,0); return 0; } for(int e=1;e<=n;++e){ maxi=max(lis(t,n,1,e,-x),maxi); } cout << maxi; }

Compilation message (stderr)

glo.cpp: In function 'int lis(int*, int, int, int, int)':
glo.cpp:14:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |         if(idx==dp.size()) dp.push_back(cur);
      |            ~~~^~~~~~~~~~~
#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...