# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
404751 | Dakto | Boxes with souvenirs (IOI15_boxes) | C++17 | 2079 ms | 45112 KiB |
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;
long long delivery(int n, int k, int l, int V[]){
vector<long long> v(V, V+n);
v.erase(v.begin(),lower_bound(v.begin(),v.end(),1));
n=v.size();
if(n==0) return 0;
vector<long long> ps, ps2(n);
long long c=0;
for(long long i=0; i<n; i++){
ps.push_back(min(2*v[i], (long long)l)+(i>=k?ps[i-k]:0));
if((i+1)%k==0){
c+=min(2*v[i],(long long)l);
}
}
for(auto i:ps) cerr<<i<<endl;
c=0;
long long j=0;
for(long long i=n-1; i>=0; i--,j++){
ps2[i]=min(2*(l-v[i]), (long long)l)+(i+k<n?ps2[i+k]:0);
if((j+1)%k==0){
c+=min(2*(l-v[i]),(long long)l);
}
}
for(auto i:ps2) cerr<<i<<endl;
long long res=min(ps[n-1],ps2[0]);
for(long long i=0; i<n-1; i++) res=min(res,ps[i]+ps2[i+1]);
for(long long i=0; i<n-k-1; i++) res=min(res,ps[i]+ps2[i+k+1]+l);
return res;
}
Compilation message (stderr)
# | 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... |