Submission #138932

#TimeUsernameProblemLanguageResultExecution timeMemory
138932TAMREFBoxes with souvenirs (IOI15_boxes)C++11
10 / 100
3 ms376 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; using ll = long long; ll delivery(int N, int K, int L, int p[]) { int s = 0, e = N - 1, k = K; while(s <= e && p[s] == 0) ++s; if(s > e) return 0; ll t = 0; while(s <= e){ int ans1 = p[min(s+k-1, e)] * 2; int ans2 = (L-p[max(s, e-k+1)]) * 2; if(ans1 < ans2){ s = min(s+k-1, e) + 1; t += ans1; }else{ e = max(s, e-k+1) - 1; t += ans2; } } return t; }
#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...