This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define ll long long
#define fi first
#define sec second
#define pb push_back
#define pqueue priority_queue
#define int long long
#define pii pair<int,int>
#define supercepat ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
using namespace std;
int tc,ans=0,n,x;
int a[200005];
int b[200005];
int copa[200005];
int rec[200005];
void findlis(){
rec[1]=1;
for(int i=1;i<=n;i++){
for(int j=1;j<=i;j++){
if(copa[j]<copa[i]) rec[i]=max(rec[i],rec[j]);
}
rec[i]++;
}
ans=max(ans,rec[n]);
}
void solve(int x,int y,int z){
for(int i=1;i<=n;i++){
copa[i]=a[i];
if(x<=i&&i<=y) copa[i]+=z;
}
findlis();
}
main(){
supercepat;
cin>>n>>x;
for(int i=1;i<=n;i++) cin>>a[i];
for(int i=1;i<=n;i++){
for(int j=i;j<=n;j++){
for(int k=-x;k<=x;k++){
cout<<i<<" "<<j<<" "<<k<<endl;
solve(i,j,k);
}
}
}
cout<<ans<<endl;
}
Compilation message (stderr)
glo.cpp:33:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
33 | main(){
| ^~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |