Submission #30552

#TimeUsernameProblemLanguageResultExecution timeMemory
30552inqrBoxes with souvenirs (IOI15_boxes)C++14
0 / 100
3 ms376 KiB
#include "boxes.h" #include <bits/stdc++.h> #define pb push_back #define mp make_pair #define rt insert #define st first #define nd second #define ll long long #define pii pair < int , int > #define DB printf("debug\n"); #define umax( x , y ) x = max( x , (y) ) #define umin( x , y ) x = min( x , (y) ) #define all(x) x.begin() , x.end() #define MAXN 10000005 using namespace std; int n,k,l; ll team_ven[MAXN]; ll min_art[MAXN]; ll min_azl[MAXN]; long long delivery(int N, int K, int L, int p[]) { n=N,k=K,l=L; for(int i=0;i<n;i++){ team_ven[i]=p[i]; } int kn=k; ll timee=0; for(int i=0;i<n;i++){ if(kn>0){ if(i==0)timee+=team_ven[i]; else timee+=team_ven[i]-team_ven[i-1]; min_art[i]=timee; kn--; } else{ timee+=team_ven[i-1]+team_ven[i]; min_art[i]=timee; kn=k; } printf("i=%d team_ven=%lld kn=%d min_art=%lld\n",i,team_ven[i],kn,min_art[i]); } kn=k; timee=0; for(int i=n-1;i>=0;i--){ if(kn>0){ if(i==n-1)timee+=(l-team_ven[i]); else timee+=team_ven[i+1]-team_ven[i]; min_azl[i]=timee; kn--; } else{ timee+=(l-team_ven[i+1])+(l-team_ven[i]); min_azl[i]=timee; kn=k; } //printf("i=%d team_ven=%lld kn=%d min_azl=%lld\n",i,team_ven[i],kn,min_azl[i]); } ll ans=1e15; for(int i=0;i<n;i++){ ans=min(ans,min_art[i]+min_azl[i+1]); } for(int i=0;i<n;i++){ if(i+k+1<=n) ans=min(ans,min_art[i]+l+min_azl[i+k+1]); } 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...