제출 #1155196

#제출 시각아이디문제언어결과실행 시간메모리
1155196aarb_.tomatexd선물상자 (IOI15_boxes)C++20
10 / 100
1 ms328 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; #define ll long long //depe ll delivery(int N, int K, int L, int p[]) { vector<ll> pos(N); for (int i = 0; i < N; i++) { pos[i] = p[i]; } vector<ll> A(N + 1, 0), B(N + 1, 0); A[0] = 0; for (int i = 1; i <= N; i++) { if (i <= K) A[i] = 2LL * pos[i - 1]; else A[i] = A[i - K] + 2LL * pos[i - 1]; } B[0] = 0; for (int i = 1; i <= N; i++) { if (i <= K) B[i] = 2LL * (L - pos[N - i]); else B[i] = B[i - K] + 2LL * (L - pos[N - i]); } ll ans = LLONG_MAX; for (int x = 0; x <= N; x++) { ll cost = A[x] + B[N - x]; ans = min(ans, cost); } return ans; }
#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...