Submission #217778

#TimeUsernameProblemLanguageResultExecution timeMemory
217778DavidDamianBoxes with souvenirs (IOI15_boxes)C++11
10 / 100
5 ms384 KiB
#include<bits/stdc++.h> //#include "boxes.h" using namespace std; typedef long long ll; long long delivery(int N, int K, int L, int p[]) { ll total=0; int remaining=K; for(int i=0;i<N;i++){ if(remaining==K) total+=(ll)min(p[i],L-p[i]); else total+=(ll)p[i]-p[i-1]; remaining--; if(remaining==0 || i==N-1){ total+=(ll)min(p[i],L-p[i]); remaining=K; } } return total; }
#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...