# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
785491 | devariaota | Global Warming (CEOI18_glo) | C++17 | 2074 ms | 4932 KiB |
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
using namespace std;
int main()
{
LL n,x;
scanf("%lld %lld",&n,&x);
LL arr[n+5];
for(LL a=1;a<=n;a++)
{
scanf("%lld",&arr[a]);
}
LL maks=0;
for(LL a=1;a<=n;a++)
{
for(LL b=a;b<=n;b++)
{
for(LL c=-x;c<=x;c++)
{
bool flag=0;
if(a==2 && b==3 && c==-5)flag=1;
LL temp[n+5];
for(LL a=1;a<=n;a++)temp[a]=arr[a];
for(LL x=a;x<=b;x++)
{
temp[x]+=c;
}
LL dp[n+5];
LL akhir=0;
for(LL d=1;d<=n;d++)
{
dp[d]=0;
for(LL e=1;e<d;e++)
{
if(temp[d]<temp[e])
dp[d]=max(dp[e],dp[d]);
}
// if(flag)printf("dp[%lld]=%lld, arr[%lld]=%lld\n",d,dp[d],d,arr[d]);
dp[d]++;
akhir=max(akhir,dp[d]);
}
maks=max(akhir,maks);
if(flag){
for(LL a=1;a<=n;a++)cout<<dp[a]<<endl;
}
flag=0;
}
}
}
cout<<maks<<endl;
}
Compilation message (stderr)
# | 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... |