#include <bits/stdc++.h>
#define TT 10000005
#define ll long long int
#define MP make_pair
#define pb push_back
#define ppb pop_back
#define sp " "
#define endl "\n"
#define fi first
#define se second
#define ii pair<int,int>
#define lli pair<ll,ll>
#define fast cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false)
#define fast2 freopen ("badhair.gir","r",stdin);freopen ("badhair.cik","w",stdout);
#define mod 1000000007
#define fs(x,y) for(ll i=1;i<=y;i++) cin>>x[i]
#define fo(i,x,y) for(ll i=x;i<=y;i++)
#define INF 1000000000005
#define ull unsigned long long int
using namespace std;
#include "boxes.h"
int ar[TT],n;
ll tut1[TT],tut2[TT];
int bos[TT];
ll sum=1e18;;
long long delivery(int m, int k, int l, int p[]) {
n=m;
fo(i,0,n-1)
p[i]=ar[i];
fo(i,0,n-1)
ar[i]=p[i];
fo(i,0,n-1)
{
if(i<k)
tut1[i]=ar[i]*2;
else
tut1[i]=tut1[i-k]+ar[i]*2;
}
for(int i=n-1;i>=0;i--)
{
if(n-i+1<k)
tut2[i]=(l-ar[i])*2;
else
tut2[i]=tut2[i+k]+(l-ar[i])*2;
}
fo(i,0,n-2)
sum=min(sum,tut1[i]+tut2[i+1]);
sum=min(sum,tut2[0]);
sum=min(sum,tut1[n-1]);
fo(i,0,n-1)
{
ll x=i+k;
if(x>=n)
break;
ll top=l;
if(i>0)
top+=tut1[i-1];
if(x<n)
top+=tut2[x];
sum=min(sum,top);
}
return sum;
}
// int main()
// {
// fast;
// int a,b;
// cin>>n>>a>>b;
// fo(i,0,n-1)
// cin>>ar[i];
// cout<<delivery(n,a,b,bos);
// }
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |