# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
416548 | LouayFarah | Holiday (IOI14_holiday) | C++14 | 18 ms | 8488 KiB |
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[d]!=-1)
return dp[d];
return dp[d] = 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 dp[d];
}
Compilation message (stderr)
# | 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... |