제출 #54475

#제출 시각아이디문제언어결과실행 시간메모리
54475MoNsTeR_CuBe선물상자 (IOI15_boxes)C++17
0 / 100
7 ms380 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*2); 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++){ ans = min(ans, f(n-i, l, k)+cost(p1[n-i],p1[n],l)); } DP[n] = ans; 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; } */

컴파일 시 표준 에러 (stderr) 메시지

boxes.cpp:26: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...