제출 #395762

#제출 시각아이디문제언어결과실행 시간메모리
395762ScarletS선물상자 (IOI15_boxes)C++17
0 / 100
1 ms332 KiB
#include <bits/stdc++.h> #define ll long long using namespace std; ll delivery(int n, int k, int l, int p[]) { int x=0,y=n-1; ll ans=0; while (x<=y) { if (y-x+1<=k) { ans+=min({l,p[y]*2,(l-p[x])*2}); break; } if (p[x+k-1]*2<(l-p[y-k+1])*2) { ans+=min(l,p[x+k-1]*2); x+=k; } else { ans+=min(l,p[l-y+k-1]*2); y-=k; } } 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...