Submission #147122

#TimeUsernameProblemLanguageResultExecution timeMemory
147122nandonathanielBoxes with souvenirs (IOI15_boxes)C++14
20 / 100
3 ms380 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; } for(LL i=0;i<N;i++){ if(i%K==0)ans+=dist(0,p[i],L); else if(i%K==K-1){ ans+=dist(p[i],p[i-1],L); ans+=dist(p[i],0,L); } else ans+=dist(p[i],p[i-1],L); } return ans; }
#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...