This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "boxes.h"
#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
typedef long long ll;
map<int,int> m;
long long delivery(int N, int K, int L, int p[]) {
for(int i=0;i<N;i++){
m[p[i]]++;
}
ll ans=0;
if(K==1){
for(auto x:m){
ans+=(ll)min(x.f,L-x.f)*(ll)x.s*2LL;
}
return ans;
}
int pp=0;
for(auto x:m){
if(x.f==L/2)return L;
if(x.f>L/2){
return min((ll)L,2LL*(ll)(pp+L-x.f));
}
pp=x.f;
}
return 2LL*pp;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |