# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
30549 | Nikefor | Boxes with souvenirs (IOI15_boxes) | C++98 | 2 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.
#include "boxes.h"
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
long long delivery(int N, int K, int L, int p[]) {
long long sum = 0;
if(N==1) {
for(int i=0; i<N; i++) {
sum+=p[i];
sum+= (p[i]<(N-p[i]))?p[i]:(N-p[i]);
}
}
else if(K==N) {
bool flag = true;
int big = 0;
int small = 0;
int mini=1<<17;
long long maxi = 0;
for (int i = 0; i < N; ++i)
{
mini = (mini<p[i])?mini:p[i];
maxi = (maxi>p[i])?maxi:p[i];
if(p[i]>(N>>1)) big++;
if(p[i]<(N>>1)) big++;
}
if(!big) sum = maxi<<1;
else if(!small) sum = (N-mini)<<1;
else sum = L;
}
return 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... |