# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
418415 | vanic | Boxes with souvenirs (IOI15_boxes) | C++14 | 1 ms | 276 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 <cmath>
#include <algorithm>
using namespace std;
typedef long long ll;
ll delivery(int n, int k, int l, int p[]) {
sort(p, p+n);
ll sol=0;
if(k==1){
for(int i=0; i<n; i++){
sol+=min(p[i], n-p[i]);
}
}
else if(k==n){
int smj=0;
for(int i=0; i<n; i++){
if(p[i]<(n-p[i])%n){
smj|=1;
}
else if(p[i]>(n-p[i])%n){
smj|=2;
}
}
if(smj==3){
sol=n;
}
else{
for(int i=0; i<n; i++){
sol=max(sol, (ll)min(p[i], n-p[i])*2);
}
}
}
return sol;
}
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... |