# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
428518 | 2021-06-15T12:31:39 Z | Mazaalai | Boxes with souvenirs (IOI15_boxes) | C++14 | 1 ms | 256 KB |
#include "boxes.h" #include <bits/stdc++.h> typedef long long ll; using namespace std; ll n, k, l, ans, tmp; vector <int> p; long long delivery(int N, int K, int L, int P[]) { n = N, k = K, l = L; for (int i = 0; i < n; i++) p.push_back(P[i]); int mid = l / 2, mid1 = l - mid; sort(p.begin(), p.end()); int a = 0, b = n-1, a1, b1; while(a < n && p[a] == 0) a++; while(a + k - 1 <= b) { a1 = a + k - 1; b1 = b - k + 1; if (a1 <= mid) { a = a1+1; ans += p[a1]*2; continue; } if (b1 >= mid1) { b = b1-1; ans += (l - p[b1])*2; continue; } } if (a <= b) { if (p[a] <= mid && p[b] >= mid1) ans += l; else ans += min(p[b], L-p[a])*2; } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Incorrect | 1 ms | 204 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Incorrect | 1 ms | 204 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Incorrect | 1 ms | 204 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Incorrect | 1 ms | 204 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Incorrect | 1 ms | 204 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |