Submission #593102

#TimeUsernameProblemLanguageResultExecution timeMemory
593102KrisjanisPBoxes with souvenirs (IOI15_boxes)C++14
20 / 100
1 ms304 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; using ll = long long; using ii = pair<ll,ll>; long long delivery(int N, int K, int L, int p[]) { if(K==1) { ll res = 0; for(ll i=0;i<N;i++) res += 2*min(p[i],L-p[i]); return res; } else if(K==N) { sort(p,p+N); int res = L; for(ll l=1;l<N;l++) { ll r = N-l; int w = p[l-1]*2 + (L-p[N-r])*2; res = min(res, w); } res = min(res,p[N-1]*2); res = min(res,(L-p[0])*2); return res; } else return 0; }
#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...