Submission #1244697

#TimeUsernameProblemLanguageResultExecution timeMemory
1244697KindaGoodGames선물상자 (IOI15_boxes)C++20
0 / 100
0 ms328 KiB
#include "boxes.h" #include<bits/stdc++.h> #define int long long #define pii pair<int,int> using namespace std; const int INF = numeric_limits<int>::max()/2; long long delivery(int32_t n, int32_t k, int32_t L, int32_t p[]) { int mi = INF; for(int s = 0; s < k; s++){ int c = 0; bool f = false; if(p[0] <= L/2 && p[s] > L/2){ c += L; f = true; }else if (p[0] <= L/2){ c += 2*p[s]; }else{ c += 2*(L-p[s]); } for(int i = s+1; i < n; i += k){ if(p[i] <= L/2 && p[min(i+k,n-1LL)] > L/2){ c += L; f = true; }else if (p[i] <= L/2){ c += 2*p[min(i+k,n-1LL)]; }else{ c += 2*(L-p[min(i+k,n-1LL)]); } } mi = min(mi, c); } return mi; }
#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...