제출 #618829

#제출 시각아이디문제언어결과실행 시간메모리
618829Hazem선물상자 (IOI15_boxes)C++14
10 / 100
1 ms320 KiB
#include <bits/stdc++.h> #define LL long long using namespace std; LL a[100010]; long long delivery(int N, int K, int L, int p[]) { int n = N,k = K; LL L1 = L; for(int i=1;i<=n;i++) a[i] = p[i-1]; sort(a+1,a+n+1); LL l = 1,r = n; LL ret = 0; for(int i=1;i<=(n+k-1)/k;i++){ LL ans1 = a[min(l+k-1,r)]*2; LL ans2 = (L1-a[max(r-k+1,l)])*2; ans1 = min(ans1,L1); ans2 = min(ans2,L1); if(ans1<ans2){ ret += ans1; l += k; } else { ret += ans2; r -= k; } } return ret; }
#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...