제출 #785492

#제출 시각아이디문제언어결과실행 시간메모리
785492makanhuliaGlobal Warming (CEOI18_glo)C++17
0 / 100
2082 ms4932 KiB
#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;
}

컴파일 시 표준 에러 (stderr) 메시지

glo.cpp: In function 'int main()':
glo.cpp:7:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |   scanf("%lld %lld",&n,&x);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~
glo.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     scanf("%lld",&arr[a]);
      |     ~~~~~^~~~~~~~~~~~~~~~
#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...