Submission #147100

#TimeUsernameProblemLanguageResultExecution timeMemory
147100nandonathanielBoxes with souvenirs (IOI15_boxes)C++14
10 / 100
2 ms376 KiB
#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; if(K==1){ for(LL i=0;i<N;i++)ans=ans+2*dist(p[i],0,L); return ans; } else if(K==N){ return min(dist(p[0],0,L)+L-p[0],dist(p[N-1],0,L)+p[N-1]); } }

Compilation message (stderr)

boxes.cpp: In function 'LL delivery(int, int, int, int*)':
boxes.cpp:20:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...