This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "bits/stdc++.h"
#include "holiday.h"
using namespace std;
#define ll long long int
vector<ll> dp;
ll solve(ll i, int d, int n, int attraction[])
{
if(d<=0)
return 0;
if(i==n)
return 0;
if(dp[i]!=-1)
return dp[i];
return dp[i] = max(solve(i+1, d-1, n, attraction), solve(i+1, d-2, n, attraction) + attraction[i]);
}
long long int findMaxAttraction(int n, int start, int d, int attraction[])
{
dp.assign(d+1, -1);
ll res = solve(start, d, n, attraction);
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |