Submission #418421

#TimeUsernameProblemLanguageResultExecution timeMemory
418421vanicBoxes with souvenirs (IOI15_boxes)C++14
10 / 100
1 ms284 KiB
#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], l-p[i])*2; } } else if(k==n){ int smj=0; for(int i=0; i<n; i++){ if(p[i]<(l-p[i])%l){ smj|=1; } else if(p[i]>(l-p[i])%l){ smj|=2; } } if(smj==3){ sol=l; } else{ for(int i=0; i<n; i++){ sol=max(sol, (ll)min(p[i], l-p[i])*2); } } } return sol; }
#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...