제출 #785450

#제출 시각아이디문제언어결과실행 시간메모리
785450devariaotaGlobal Warming (CEOI18_glo)C++17
0 / 100
2067 ms1832 KiB
#include<bits/stdc++.h> #define sherina ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define pb push_back #define int long long #define INF 1e18 #define endl '\n' using namespace std; int n , x , t[200005]; vector < int > v; signed main(){ cin >> n >> x; for(int i = 1 ; i <= n ; i++) cin >> t[i]; int maks = 0; for(int i = 1 ; i <= n ; i++){ for(int j = i + 1 ; j <= n ; j++){ for(int k = -x ; k <= x ; k++){ v.clear(); for(int l = i ; l <= j ; l++) t[l] += k; for(int l = 1 ; l <= n ; l++){ int tmp = v.size(); if(!tmp) v.pb(t[l]); else if(t[l] > v[tmp - 1]) v.pb(t[l]); else{ int id = upper_bound(v.begin() , v.end() , t[l]) - v.begin(); v[id] = t[l]; } } for(int l = i ; l <= j ; l++) t[l] -= k; int sie = v.size(); maks = max(maks , sie); } } } cout << maks << endl; }
#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...