Submission #412931

#TimeUsernameProblemLanguageResultExecution timeMemory
412931ScarletSBoxes with souvenirs (IOI15_boxes)C++17
10 / 100
1 ms300 KiB
#include <bits/stdc++.h> #define ll long long using namespace std; const int INF = 2e9+7; ll delivery(int n, int k, int l, int p[]) { int x=0,y=n-1; ll ans=0; for (int i=k-1;i<n;i+=k) { if (p[i]>(l-1)/2) break; x=i+1; ans+=p[i]*2; //cout<<p[i]*2<<"!\n"; } for (int i=n-k;i>=0;i-=k) { if (p[i]<(l+2)/2) break; y=i-1; ans+=(l-p[i])*2; //cout<<(l-p[i])*2<<"!\n"; } //cout<<x<<" "<<y<<"\n"; ans+=1LL*((y-x+k)/k)*l; return ans; } // int main() // { // int n,k,l; // cin>>n>>k>>l; // int p[n]; // for (int i=0;i<n;++i) // cin>>p[i]; // cout<<delivery(n,k,l,p); // }
#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...