제출 #1232511

#제출 시각아이디문제언어결과실행 시간메모리
123251112baater선물상자 (IOI15_boxes)C++20
10 / 100
0 ms328 KiB
#include "boxes.h"
#include <algorithm>

long long delivery(int N, int K, int L, int p[]) {

    int maxUnder = 0, minOver = 2000000000;
    for (int i = 0; i < N; i++) {
        if (p[i] > L/2) {
            minOver = std::min(minOver, p[i]);
        } else {
            maxUnder = std::max(maxUnder, p[i]);
        }
    }

    long long total = 0;
    if (maxUnder == 0) {
        return 2*(L-minOver);
    } else if (minOver == 2000000000) {
        return 2*maxUnder;
    } else {
        return std::min(L, 2*(maxUnder + L - minOver));
    }

}
#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...