# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
81678 | wzy | Boxes with souvenirs (IOI15_boxes) | C++11 | 15 ms | 376 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>
#include "boxes.h"
using namespace std;
long long delivery(int N, int K, int L, int p[]) {
#define int long long
int ans = (int) 1e18;
int k = K;
int n = N;
int l = L;
for(int j = N - 1 ; j >= 0 ; j--){
for(int r = 0 ; (j - k*r + 1) >= 0 ; r++){
int u = j - k*r + 1;
if(u > j) continue;
// cout<<u<<" " << j <<" " << ans << endl;
ans = min(ans , 2*p[u]*((u+1)/k + ((u+1)%k ? 1 : 0)) + 2*(L - p[j])*((n - j)/k + ((n-j)%k ? 1 : 0)) + L*((j-u+1)/k + ((j-u+1)%k ? 1 : 0)));
// cout<<u<<" " << j <<" " << ans << endl;
}
// cout<<"__"<<endl;
// cout<<j <<" " << ans << endl;
ans = min(ans , 2*(L - p[j])*((n-j)/k + ((n-j)%k ? 1 : 0)) + L*((j)/k + (j%k ? 1 : 0)));
// cout<<j <<" " << ans << endl;
int i = j;
ans = min(ans , 2*p[i]*((i+1)/k + ((i+1)%k ? 1 : 0)) + L *((n-i-1)/k + ((n-i-1)%k ? 1 : 0)));
// cout<<j <<" " << ans <<" "<<endl;
// cout<<"__"<<endl;
}
return ans;
}
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... |