Submission #416548

#TimeUsernameProblemLanguageResultExecution timeMemory
416548LouayFarahHoliday (IOI14_holiday)C++14
0 / 100
18 ms8488 KiB
#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)

holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:25:8: warning: unused variable 'res' [-Wunused-variable]
   25 |     ll res = solve(start, d, n, attraction);
      |        ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...