#include "bits/stdc++.h"
#include "holiday.h"
using namespace std;
#define ll long long int
ll solve(ll i, int day, int n, int attraction[])
{
if(day<=0)
return 0;
if(i==n)
return 0;
return max(solve(i+1, day-1, n, attraction), solve(i+1, day-2, n, attraction) + attraction[i]);
}
long long int findMaxAttraction(int n, int start, int d, int attraction[])
{
return solve(0, d, n, attraction);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
588 KB |
Output is correct |
2 |
Correct |
6 ms |
588 KB |
Output is correct |
3 |
Correct |
5 ms |
588 KB |
Output is correct |
4 |
Correct |
5 ms |
588 KB |
Output is correct |
5 |
Incorrect |
1 ms |
588 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5051 ms |
6820 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5034 ms |
844 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5060 ms |
6816 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |