Submission #183724

#TimeUsernameProblemLanguageResultExecution timeMemory
183724mohammadBoxes with souvenirs (IOI15_boxes)C++14
10 / 100
3 ms376 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[]){ ans = min(ans , (ll)(L - p[0]) + min((ll)p[0] , (ll)(L - p[0]))); ans = min(ans , (ll)p[N - 1] + min((ll)(p[N - 1]) , (ll)(L - p[N - 1]))); for(int i = 0 ; i < N - 1 ; ++i) ans = min(ans , (ll)(p[i] * 2) + (ll)(L - p[i + 1]) * 2 ); return ans; }

Compilation message (stderr)

boxes.cpp: In function 'll delivery(int, int, int, int*)':
boxes.cpp:31:24: warning: unused parameter 'K' [-Wunused-parameter]
 ll delivery(int N, int K, int L, int p[]){
                        ^
#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...