Submission #54472

#TimeUsernameProblemLanguageResultExecution timeMemory
54472MoNsTeR_CuBeBoxes with souvenirs (IOI15_boxes)C++17
0 / 100
7 ms376 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; #define int long long #define INF 9223372036854775807 vector<int> p1; vector<int> DP; int cost(int a, int b, int c){ int ans = c; ans = min(ans, (c-(a-1))*2); ans = min(ans, b); return ans; } int f(int n, int l, int k){ if(DP[n] != INF) return DP[n]; int ans = INF; for(int i = 1; i < k; i++){ DP[n] = min(ans, f(n-i, l, k)+cost(p1[n-i],p1[n],l)); } return ans; } #undef int long long long long delivery(int N, int K, int L, int p[]) { #define int long long DP.assign(N+1, INF); for(int i = 0; i < N; i++){ p1.push_back(p[i]); } return f(N,L,K); } /* signed main(){ int N, K, L; cin >> N >> K >> L; int tab[N]; DP.resize(N); for(int i = 0; i < N; i++){ cin >> tab[i]; } #undef int long long cout << delivery(N,K,L,tab) << endl; } */

Compilation message (stderr)

boxes.cpp:25:12: warning: extra tokens at end of #undef directive
 #undef int long long
            ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...