제출 #415923

#제출 시각아이디문제언어결과실행 시간메모리
415923LouayFarah휴가 (IOI14_holiday)C++14
0 / 100
66 ms65540 KiB
#include "bits/stdc++.h" #include "holiday.h" using namespace std; #define ll long long int vector<bool> visited; ll solve(vector<vector<ll>> &dp, int c, int d, int n, int attraction[]) { if(d==0) return 0; if(dp[c][d]!=-1) return dp[c][d]; ll nb = 0; if(c>0) nb = max(nb, solve(dp, c-1, d-1, n, attraction)); if(c<n-1) nb = max(nb, solve(dp, c+1, d-1, n, attraction)); if(!visited[c]) { visited[c] = true; nb = max(nb, attraction[c] + solve(dp, c, d-1, n, attraction)); visited[c] = false; } return dp[c][d] = nb; } long long int findMaxAttraction(int n, int start, int d, int attraction[]) { vector<vector<ll>> dp(n, vector<ll>(d+1, -1)); visited.assign(n, false); ll res = solve(dp, start, d, n, attraction); return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...