Submission #254215

#TimeUsernameProblemLanguageResultExecution timeMemory
254215eohomegrownappsBoxes with souvenirs (IOI15_boxes)C++14
10 / 100
1 ms384 KiB
#include "boxes.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

ll delivery(int n, int k, int l, int p[]) {
    ll scoremin = 1e18;
    ll scoretot = 0;
    for (int i = 0; i<n; i+=k){
        int s = i;
        int e = min(i+k-1,n-1);
        scoretot+=min(l,min((l-p[s])*2,p[e]*2));
    }
    //cout<<scoretot<<'\n';
    scoremin=min(scoremin,scoretot);
    scoretot=0;
    for (int i = n-1; i>=0; i-=k){
        int s = max(0,i-k+1);
        int e = i;
        scoretot+=min(l,min((l-p[s])*2,p[e]*2));
    }
    //cout<<scoretot<<'\n';
    return scoretot;
}
#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...