Submission #778042

#TimeUsernameProblemLanguageResultExecution timeMemory
778042Jarif_Rahman선물상자 (IOI15_boxes)C++17
20 / 100
3 ms312 KiB
#include "boxes.h"
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;

ll delivery(int n, int k, int L, int P[]){
    ll ans = 1e18;

    for(int i = 0; i <= n; i++){
        int r = k;
        ll cur = 0;
        for(int j = 0; j < i; j++){
            r--;
            if(j+1 == i || r == 0) cur+=P[j]+min(P[j], L-P[j]), r = k;
        }
        for(int j = n-1; j >= i; j--){
            r--;
            if(j == i || r == 0) cur+=L-P[j]+min(P[j], L-P[j]), r = k;
        }
        ans = min(ans, cur);
    }

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