Submission #1082224

#TimeUsernameProblemLanguageResultExecution timeMemory
1082224raphael_heuchlBoxes with souvenirs (IOI15_boxes)C++14
10 / 100
0 ms428 KiB
#include "boxes.h"
#define INF 5'000'000'000'000'000'000
#define MIN(a, b) ((a) < (b) ? (a) : (b))
typedef long long ll;

ll delivery(int N, int K, int L, int p[])
{
    ll best = INF;
    for (ll i = 0; i < K; ++i)
    {
        ll sum = MIN(L, p[i]<<1);
        ll pos = i;

        while (pos < N-1)
            sum += MIN(L - (p[pos+1]<<1), 0),
            pos = MIN(pos+K, N-1),
            sum += MIN(L, p[pos]<<1);

        best = MIN(best, sum);
    }

    return best;
}
#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...