Submission #952816

#TimeUsernameProblemLanguageResultExecution timeMemory
952816irmuunGlobal Warming (CEOI18_glo)C++17
25 / 100
2064 ms3036 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define ff first #define ss second #define all(s) s.begin(),s.end() #define rall(s) s.rbegin(),s.rend() int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); ll n,x; cin>>n>>x; ll t[n+5]; for(ll i=1;i<=n;i++){ cin>>t[i]; } ll ans=0; vector<ll>v; for(ll i=1;i<=n;i++){ if(v.empty()||v.back()<t[i]){ v.pb(t[i]); } else{ ll x=lower_bound(all(v),t[i])-v.begin(); v[x]=t[i]; } } ans=v.size(); for(ll d=-x;d<=x;d++){ if(d==0) continue; for(ll l=1;l<=n;l++){ for(ll r=1;r<=n;r++){ for(ll j=l;j<=r;j++){ t[j]+=d; } v.clear(); for(ll i=1;i<=n;i++){ if(v.empty()||v.back()<t[i]){ v.pb(t[i]); } else{ ll x=lower_bound(all(v),t[i])-v.begin(); v[x]=t[i]; } } ans=max(ans,(ll)v.size()); for(ll j=l;j<=r;j++){ t[j]-=d; } } } } cout<<ans; }
#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...