# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
30520 | laptop_recai | Boxes with souvenirs (IOI15_boxes) | C++98 | 3 ms | 376 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.
//Bismillahirrahmanirrahim
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll sum,ans1,ans2,ans3;
int lsz,rsz;
vector<ll> l,r;
#include "boxes.h"
long long delivery(int N, int k, int L, int p[]) {
for(int i = 0; i < N; i++) {
if(p[i] <= L >> 1)
l.push_back(p[i]<<1);
else
r.push_back((L-p[i])<<1);
}
for(int i = k-1; i < l.size(); i += k) {
sum += l[i];
}
for(int i = k-1; i < r.size(); i += k) {
sum += r[i];
}
lsz = l.size();
rsz = r.size();
ans1 = sum + (rsz%k ? r.back() : 0) + (lsz%k ? l.back() : 0);
int x = rsz-1-(k-lsz%k);
ans2 = sum + L + (x >= 0 ? r[x] : 0);
x = lsz-1-(k-rsz%k);
ans3 = sum + L + (x >= 0 ? l[x] : 0);
return min(ans1,min(ans2,ans3));
}
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... |