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<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()
ll delivery(int N,int K,int L,int pos[]){
ll ans=0;
vector<int>l,r;
for(int i=0;i<N;i++){
if(pos[i]<L-pos[i]){
l.pb(pos[i]);
}
else{
r.pb(L-pos[i]);
}
}
for(int i=K-1;i<(int)l.size();i+=K){
ans+=l[i]*2;
}
for(int i=K-1;i<(int)r.size();i+=K){
ans+=r[i]*2;
}
int left=(int)l.size()%K+(int)r.size()%K;
int need=(left+K-1)/K;
ans+=(ll)need*L;
return ans;
}
# | 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... |