# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
937620 | 2024-03-04T09:44:00 Z | danikoynov | Boxes with souvenirs (IOI15_boxes) | C++14 | 1 ms | 2648 KB |
#include "boxes.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; const ll inf = 1e18; const int maxn = 1e7 + 10; int n, k; ll p[maxn], temp[maxn]; ll L; ll get_price_left(int x) { ll res = 0; int t = 0; for (int i = 0; i < x; i ++) { //t ++; //if (t == x || t % k == 0) res = res + 2 * p[i]; } return res; } ll get_price_right(int x) { ll res = 0; int t = 0; for (int i = n - 1; i >= n - x; i --) { //t ++; //if (t == x || t % k == 0) res = res + 2 * (L - p[i]); } return res; } long long delivery(int N, int K, int _L, int P[]) { for (int i = 0; i < N; i ++) p[i] = P[i]; n = N; k = K; L = _L; ll ans = 0; for (int i = 0; i < N; i ++) { ans = ans + 2 * min(p[i], L - p[i]); } //cout << get_price_right(1) << endl; ///exit(0); ll res = inf; for (int i = 0; i < N; i ++) { ll val = get_price_left(i) + get_price_right(N - i); //cout << i << " " << val << endl; res = min(res, val); //if (N - i - k >= 0) //{ // val = get_price_left(i) + get_price_right(N - i - k) + L; //res = min(res, val); //} } return res; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2392 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2396 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2648 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2392 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2392 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2392 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |