# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
781969 | Lyrically | Boxes with souvenirs (IOI15_boxes) | C++17 | 901 ms | 332 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
int read(){int x;scanf("%d",&x);return x;}
void print(int x){printf("%d\n",x);}
const int mod=1000000007;
long long delivery(int n,int k,int l,int p[])
{
double st=clock();
long long res=(1LL<<60);
while(clock()-st<0.9*CLOCKS_PER_SEC)
{
long long tot=0;
for(int i=0;i<n;i+=k)
{
vector<int> v;
for(int j=i;j<=min(i+k-1,n-1);j++){v.pb(p[j]);}
int tmp=l;
int ldis=0,rdis=0;
for(auto x:v)
{
if(x<=l-x){ldis=max(ldis,x);}
else{rdis=max(rdis,l-x);}
}
tmp=min(tmp,2*(ldis+rdis));
tot+=tmp;
}
res=min(res,tot);random_shuffle(p,p+n);
}
return res;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |