제출 #1027869

#제출 시각아이디문제언어결과실행 시간메모리
1027869MarwenElarbi휴가 (IOI14_holiday)C++17
0 / 100
7 ms824 KiB
// Sample grader #include <bits/stdc++.h> #include"holiday.h" using namespace std; #define pb push_back long long int findMaxAttraction(int n, int start, int d, int attraction[]){ long long dp[3000][3000]; /*for (int i = 0; i < n; ++i) { for (int j = 0; j <= d; ++j) { dp[i][j]=-1e18; } } dp[start][0]=0; long long ans=0; for (int i = start; i >= 0; --i) { for (int j = d; j >= 0; --j) { if(j){ dp[i][j]=max(dp[i][j-1]+1ll*attraction[i],dp[i][j]); } if(i&&j<d){ dp[i-1][j+1]=max(dp[i-1][j+1],dp[i][j]); } if(start-i+j+1<=d&&start<n-1){ dp[start+1][j+start-i+1]=max(dp[i][j],dp[start+1][j+start-i+1]); } ans=max(ans,dp[i][j]); } } for (int i = start+1; i < n; ++i) { for (int j = d; j >= 0; --j) { if(j){ dp[i][j]=max(dp[i][j],dp[i][j-1]+1ll*attraction[i]); } if(i<n-1&&j<d){ dp[i+1][j+1]=max(dp[i+1][j+1],dp[i][j]); } ans=max(ans,dp[i][j]); } } for (int i = 0; i < n; ++i) { for (int j = 0; j <= d; ++j) { dp[i][j]=-1e18; } } dp[start][0]=0; for (int i = start; i < n; ++i) { for (int j = d; j >= 0; --j) { if(j){ dp[i][j]=max(dp[i][j-1]+1ll*attraction[i],dp[i][j]); } if(i<n-1&&j<d){ dp[i+1][j+1]=max(dp[i+1][j+1],dp[i][j]); } if(i-start+j+1<=d&&start>0){ //cout <<i<<" "<<j<<" "<<j-start+i+1<<" "<<dp[i][j]<<endl; dp[start-1][j-start+i+1]=max(dp[i][j],dp[start-1][j-start+i+1]); } ans=max(ans,dp[i][j]); } } for (int i = start-1; i >= 0; --i) { for (int j = d; j >= 0; --j) { if(j){ dp[i][j]=max(dp[i][j],dp[i][j-1]+attraction[i]); } if(i&&j<d){ dp[i-1][j+1]=max(dp[i-1][j+1],dp[i][j]); } ans=max(ans,dp[i][j]); } }*/ return 0; }

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

holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:7:15: warning: unused variable 'dp' [-Wunused-variable]
    7 |     long long dp[3000][3000];
      |               ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...