제출 #785467

#제출 시각아이디문제언어결과실행 시간메모리
785467devariaotaGlobal Warming (CEOI18_glo)C++17
15 / 100
2074 ms1776 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 ; 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 = lower_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(); //cout << i << " " << j << " " << k << " " << sie << endl; 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...