Submission #728580

#TimeUsernameProblemLanguageResultExecution timeMemory
728580AndrijaMBoxes with souvenirs (IOI15_boxes)C++14
0 / 100
1 ms212 KiB
#include <bits/stdc++.h> using namespace std; long long delivery(int n, int k, int L, int p[]) { long long ans=0; long long l=0; long long r=n-1; while(true) { if(l>=r)break; long long mi1=2e9; long long a=l+k-1; if(a<=r) { mi1=min(2*p[a], L); } long long mi2=2e9; long long b=r-k+1; if(b>=l) { mi2=min(2*(n-p[b]-1), L); } if(mi1<=mi2) { ans+=mi1; l=a; } else if(mi1>mi2) { ans+=mi2; r=b; } } 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...