#include"holiday.h"
#include <bits/stdc++.h>
using namespace std;
long long dp[3002][3002];
long long int findMaxAttraction(int n, int start, int d, int a[]) {
//dp[i][j] : best score if i visit city i on the jth day
if(d==0) return 0;
dp[start][1] = a[1];
long long ans = a[1];
for(int j = 2; j <= d; ++j){
for(int i = 0; i < n; ++i){
dp[i][j] = 0;
for(int k = 1; k < n; ++k){
if(j-k-1 >= 1){
if(i-k >= 0)
dp[i][j] = max(dp[i][j], a[i] + dp[i-k][j-k-1]);
if(i+k < n)
dp[i][j] = max(dp[i][j], a[i] + dp[i+k][j-k-1]);
}
}
ans = max(ans, dp[i][j]);
}
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
346 ms |
26092 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
5049 ms |
20700 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
25 ms |
1260 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |