# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
81679 | 2018-10-26T06:40:18 Z | wzy | Boxes with souvenirs (IOI15_boxes) | C++11 | 8 ms | 376 KB |
#include <bits/stdc++.h> #include "boxes.h" using namespace std; long long dpL[10000001] , dpR[10000001]; 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 i = 0 ; i < N ;i ++){ dpL[i] = 2*p[i]; if(i >= K) dpL[i] = dpL[i-k] + 2*p[i]; // pick the last block and then solve for [0 , i-k] } for(int j = N - 1 ; j >= 0 ; j--){ int u = j + K ; dpR[j] = 2*(L - p[j]); if(u <= n - 1) dpR[j] = dpR[u] + 2*(L - p[j]); } 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; ans = min(ans ,dpL[u] + dpR[j] + L*((j-u+1)/k + ((j-u+1)%k ? 1 : 0))); } ans = min(ans , dpR[j] + L*((j)/k + (j%k ? 1 : 0))); int i = j; ans = min(ans ,dpL[j] + L *((n-i-1)/k + ((n-i-1)%k ? 1 : 0))); } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 8 ms | 376 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Incorrect | 2 ms | 376 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Incorrect | 2 ms | 256 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 8 ms | 376 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 8 ms | 376 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 8 ms | 376 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |