제출 #785552

#제출 시각아이디문제언어결과실행 시간메모리
785552makanhuliaGlobal Warming (CEOI18_glo)C++17
15 / 100
2072 ms4180 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=1; 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=1; 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++){ // cout<<i<<' '<<j<<"//"; vector<int> tmp = a; for(int l=i; l<=j; l++){ tmp[l] += k; } // for(int l=1;l<=n;l++) cout<<tmp[l]<<' '; // cout<<":: "; // cout<<cek(tmp)<<'\n'; 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...