Submission #73624

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
736242018-08-28 15:45:12aleksamBoxes with souvenirs (IOI15_boxes)C++14
0 / 100
2 ms376 KiB
#include "boxes.h"
#include <bits/stdc++.h>
#define MAX_N 10000000
using namespace std;
long long r[MAX_N], l[MAX_N];
int p[MAX_N];
int N, K, L;
void compute_l(){//l[i]=cena koju moram da platim ako hocu da snabdem sve do i-tog direktno
for(int i=0; i<N; ++i){
if(i%K!=0)l[i]=l[i-1]-p[i-1]+p[i];
else l[i]=l[i-1]+p[i];
}
for(int i=0; i<N; ++i){
l[i]*=2;
}
}
void compute_r(){
for(int i=N-1; i>=0; --i){//r[i]=cena za koju mogu da garantujem da pokrivam sve od i do N-1
if((N-1-i)%K!=0)r[i]=r[i+1]+(L-p[i])-(L-p[i+1]);
else r[i]=r[i+1]+L-p[i];
}
for(int i=0; i<N; ++i){
r[i]*=2;
}
}
long long delivery(int n, int k, int li, int P[]) {
N=n;K=k;L=li;
int nula=0;
while(nula<N && P[nula]==0)nula++;
N-=nula;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...