# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
147116 | nandonathaniel | Boxes with souvenirs (IOI15_boxes) | C++14 | 2 ms | 504 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;
LL dist(LL x,LL y,LL mod){
return min((y-x+mod)%mod,(x-y+mod)%mod);
}
LL delivery(int N, int K, int L, int p[]) {
LL ans=0;
for(LL i=0;i<N;i++)ans=ans+2*dist(p[i],0,L);
if(K==1)return ans;
else if(K==N){
ans=dist(p[0],0,L);
for(LL i=1;i<N;i++)ans=ans+dist(p[i],p[i-1],L);
ans=ans+dist(p[N-1],0,L);
return ans;
}
}
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... |