# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
162721 | 2019-11-09T14:08:37 Z | RoundMango | Boxes with souvenirs (IOI15_boxes) | C++14 | 2 ms | 384 KB |
#include <bits/stdc++.h> #include "boxes.h" using namespace std; long long n, k, l, m, cnt, t, a, lft[10000], ans, x, y, v, ans1, rt[10000], curr; long long delivery(int N, int K, int L, int p[]) { N = n; K = k; L = l; for (int i = 0; i < n; i++) { if (p[i] <= l-p[i]) lft[a] = p[i], a++; else rt[v] = l-p[i], v++; } t = a-k+1; ans = 1e18; for (int i = 0; i < k; i++) { curr = ans; ans = 0; x = t+i; y = t+i+k; if (t < 0) t = 0; for (int j = 0; j < x; j++) { cnt++; if (cnt%k == 0) ans += 2*p[j], cnt = 0; } if (cnt) ans += 2*p[x-1], cnt = 0; for (int j = t+i+k; j < n; j++) { cnt++; if (cnt%k == 0) ans += (l-p[j-k+1])*2, cnt = 0; } if (cnt) ans += 2*(l - p[n-cnt%k]), cnt = 0; ans = min(ans, curr); } ans += l; for (int i = 0; i < a; i++) { cnt++; if (cnt%k == 0) ans1 += lft[i], cnt = 0; } if (cnt) ans1 += 2*lft[a-1], cnt = 0; sort(rt,rt+v); for (int i = 0; i < v; i++) { cnt++; if (cnt%k == 0) ans1 += rt[i], cnt = 0; } if (cnt) ans1 += 2*rt[v-1], cnt = 0; return min(2*ans1,ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |