# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
407339 | MDario | Boxes with souvenirs (IOI15_boxes) | C++11 | 1 ms | 332 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>
using namespace std;
typedef long long ll;
#define F first
#define S second
long long delivery(int n, int k, int l, int p[]){
vector<pair<ll, ll>> v1, v2;
v1.push_back({0, 0});
v2.push_back({0, 0});
for(int i=0; i<n; i++){
if(p[i]!=0){
if(p[i]<=l/2)v1.push_back({p[i], 0});
}
}
for(int i=n-1; i>=0; i--){
if(p[i]!=0){
if(p[i]>l/2)v2.push_back({l-p[i], 0});
}
}
for(int i=0; i<v1.size(); i++){
if(i<k)v1[i].S=v1[i].F*2;
else v1[i].S=v1[i].F*2+v1[i-k].S;
}
for(int i=0; i<v2.size(); i++){
if(i<k)v2[i].S=v2[i].F*2;
else v2[i].S=v2[i].F*2+v2[i-k].S;
}
ll r=v1.back().S+v2.back().S;
return r;
}
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... |