Submission #785532

#TimeUsernameProblemLanguageResultExecution timeMemory
785532makanhuliaGlobal Warming (CEOI18_glo)C++17
0 / 100
2074 ms2388 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define fi first #define se second ll n,x; // int lis[200005][200005]; // prev, cur ll cek(vector<int> x){ ll tmp[n+5]; ll ans=0; for(int i=n;i>0;i--){ tmp[i]=1; for(int j=i+1;j<=n;j++){ if(x[j]>x[i]) tmp[i] = max(tmp[j]+1, tmp[i]); } ans=max(ans,tmp[i]); } return ans; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>n>>x; vector<int> a(n+1); ll ans=0; for(int i=1;i<=n;i++){ cin>>a[i]; } for(int i=1;i<=n;i++){// pilih segmen for(int j=i;j<=n;j++){ for(int k=-1*x;k<x;k++){ vector<int> tmp = a; for(int l=i; l<=j; l++){ tmp[l] += k; } ans = max(cek(tmp),ans); } } } cout<<ans<<'\n'; return 0; }
#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...