# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
671763 | mseebacher | Boxes with souvenirs (IOI15_boxes) | C++17 | 1 ms | 212 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 <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
ll sum = 0;
ll delivery(int N, int K, int L, int pos[]){
sum+= pos[0];
for(int i = 1;i<N;i++){
if(pos[i]-pos[i-1] > L/2){
sum += pos[i-1];
sum += abs(pos[i]-L);
}else{
sum += pos[i]-pos[i-1];
}
}
sum += min(pos[N-1],abs(pos[N-1]-L));
ll erg = sum;
sum = 0;
sum+= abs(pos[N-1]-L);
for(int i = N-1;i>0;i--){
if(pos[i]-pos[i-1] > L/2){
sum += pos[i-1];
sum += abs(pos[i]-L);
}else{
sum += pos[i]-pos[i-1];
}
}
sum += min(pos[0],abs(pos[0]-L));
return min(erg,sum);
}
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... |