# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
604264 | wiwiho | Boxes with souvenirs (IOI15_boxes) | C++14 | 693 ms | 295760 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 "boxes.h"
#include <bits/stdc++.h>
#define iter(a) a.begin(), a.end()
#define lsort(a) sort(iter(a))
#define gsort(a) sort(iter(a), greater<>())
#define eb emplace_back
#define ef emplace_front
#define pob pop_back()
#define pof pop_front()
#define mp make_pair
#define F first
#define S second
#define uni(a) a.resize(unique(iter(a)) - a.begin())
#define printv(a, b){ \
for(auto pv : a) b << pv << " "; \
b << "\n"; \
}
using namespace std;
typedef long long ll;
typedef long double ld;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename A, typename B>
ostream& operator<<(ostream& o, pair<A, B> p){
return o << '(' << p.F << ',' << p.S << ')';
}
ll delivery(int n, int K, int _L, int _p[]){
ll len = _L;
vector<ll> p;
p.eb(0);
for(int i = 0; i < n; i++){
if(_p[i] != 0) p.eb(_p[i]);
}
p.eb(len);
n = p.size();
vector<ll> ans(n);
{
vector<ll> sum(K);
for(int i = 0; i < n; i++){
sum[i % K] += p[i] + min(p[i], len - p[i]);
ans[i] += sum[i % K];
}
}
{
vector<ll> sum(K);
for(int i = n - 1; i >= 0; i--){
sum[i % K] += (len - p[i]) + min(p[i], len - p[i]);
ans[(i - 1 + n) % n] += sum[i % K];
}
}
return *min_element(iter(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... |