제출 #185311

#제출 시각아이디문제언어결과실행 시간메모리
185311mohammad선물상자 (IOI15_boxes)C++14
0 / 100
2 ms504 KiB
/* ░░░░██████████████████ ░░▄███████▀▀▀▀▀▀███████▄ ░▐████▀▒mohammad▒▀██████▄ ░███▀▒▒▒▒alaa▒▒▒▒▒▒▀█████ ░▐██▒▒▒alwrawrah▒▒▒▒▒████▌ ░▐█▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████▌ ░░█▒▄▀▀▀▀▀▄▒▒▄▀▀▀▀▀▄▒▐███▌ ░░░▐░░░▄▄░░▌▐░░░▄▄░░▌▐███▌ ░▄▀▌░░░▀▀░░▌▐░░░▀▀░░▌▒▀▒█▌ ░▌▒▀▄░░░░▄▀▒▒▀▄░░░▄▀▒▒▄▀▒▌ ░▀▄▐▒▀▀▀▀▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒█ ░░░▀▌▒▄██▄▄▄▄████▄▒▒▒▒█▀ ░░░░▄██████████████▒▒▐▌ ░░░▀███▀▀████▀█████▀▒▌ ░░░░░▌▒▒▒▄▒▒▒▄▒▒▒▒▒▒▐ ░░░░░▌▒▒▒▒▀▀▀▒▒▒▒▒▒▒▐ */ #include<bits/stdc++.h> #include "boxes.h" using namespace std; typedef long long ll ; const ll oo = 1e13 ; const double PI = acos(-1) ; const ll M = 1e9 + 7 ; ll ans = 1e18; ll delivery(int N, int K, int L, int p[]){ int n = N , k = K ; sort(p , p + n); for(int i = 0 ; i < k - 1 ; ++i){ ll d = 0 ; int j ; for(j = i ; j + K - 1 < N ; j += K) d += min(p[j + k - 1] + min(p[j + k - 1] , L - p[j + k - 1]) , L - p[j] + min(L - p[j] , p[j])); if(j != N) d += min(p[N -1] + min(p[N - 1] , L - p[N - 1]) , L - p[j - k + 1] + min(L - p[j - k + 1] , p[j - k + 1])); if(i) d+= min(L - p[0] + min(L - p[0] , p[0]) , p[i - 1] + min(p[i - 1] , L - p[i - 1])); ans = min(ans , d); } 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...