제출 #1082219

#제출 시각아이디문제언어결과실행 시간메모리
1082219raphael_heuchl선물상자 (IOI15_boxes)C++14
10 / 100
1 ms440 KiB
#include "boxes.h" #include <vector> #include <algorithm> #include <map> #include <iostream> #define INF 1'000'000'000'000'000'000 #define ABS(a) ((a) > 0 ? (a) : -(a)) #define MIN(a, b) ((a) < (b) ? (a) : (b)) long long delivery(int N, int K, int L, int p[]) { long long best = INF; for (int i = 0; i < K; ++i) { long long sum = 0; long long pos = i; sum += p[i] + MIN(p[i], L - p[i]); while (pos < N-1) { sum += MIN(p[pos+1], L - p[pos+1]); sum += (pos+K < N ? p[pos+K] : p[N-1]) - p[pos+1]; pos = MIN(pos+K, N-1); sum += MIN(p[pos], L - p[pos]); } best = MIN(best, sum); } return best; }
#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...