제출 #67293

#제출 시각아이디문제언어결과실행 시간메모리
67293theknife2001휴가 (IOI14_holiday)C++17
0 / 100
389 ms66560 KiB
#include"holiday.h" #include <bits/stdc++.h> using namespace std; const int N=3055; long long dp[N][N*3]; bool vis[N]; int a[N]; int n; long long bt(int i , int d) { if(d==0) return 0; // if(dp[i][d]!=-1) // return dp[i][d]; if(d==1) { if(!vis[i]) dp[i][d]=a[i]; else dp[i][d]=0; return dp[i][d]; } long long ret=0; if(i+1<n) ret=max(bt(i+1,d-1),ret); if(i) ret=max(bt(i-1,d-1),ret); if(i+1<n&&!vis[i]) { vis[i]=1; ret=max(bt(i+1,d-2)+a[i],ret); vis[i]=0; } if(i&&!vis[i]) { vis[i]=1; ret=max(bt(i-1,d-2)+a[i],ret); vis[i]=0; } dp[i][d]=ret; return ret; } long long int findMaxAttraction(int m, int start, int d, int ar[]) { memset(dp,-1,sizeof dp); n=m; for(int i=0;i<n;i++) a[i]=ar[i]; return bt(start,d); }

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

grader.cpp: In function 'int main()':
grader.cpp:7:12: warning: variable 'n_s' set but not used [-Wunused-but-set-variable]
     int i, n_s;
            ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...