Submission #63299

# Submission time Handle Problem Language Result Execution time Memory
63299 2018-08-01T09:48:42 Z hamzqq9 Boxes with souvenirs (IOI15_boxes) C++14
0 / 100
2 ms 376 KB
#include<bits/stdc++.h>
#include "boxes.h"
using namespace std;
#define MAX 1000006
#define ll long long
#define umin(x,y) x=min(x,y)
#define umax(x,y) x=max(x,y)
#define inf 100000000000000000

int Left[MAX],Right[MAX];
ll sumR[MAX],sumL[MAX];

long long delivery(int N, int K, int L, int P[]) {

	int curL=0,curR=0;
	int pro=0;

	for(int i=0;i<N;i++) {

		if(P[i]==0) continue ;

		if(P[i]<=(L-1)/2) {

			Left[curL++]=P[i];

		}
		else if(P[i]>=(L%2?(L+1)/2:L/2+1)) {

			Right[curR++]=P[i];

		}
		else {

			pro++;

		}

	}

	return pro;

	for(int i=0;i<curR;i++) {

		if(i-K>=0) sumR[i]=sumR[i-K]+Right[i];
		else sumR[i]=Right[i];

	}

	for(int i=0;i<curL;i++) {

		if(i-K>=0) sumL[i]=sumL[i-K]+Left[i];
		else sumL[i]=Left[i];

	}	

	ll ans=(pro+K-1)/K*L/2;

	int rem=(pro?K-pro%K:0);

	ll add=inf;

	for(int i=0;i<=(N-pro+K-1)/K;i++) {

		int use=min(rem+i*K,N-pro);

		ll cev=inf;

		for(int j=0;j<=use;j++) {

			umin(cev,sumR[curR-1-j]+sumL[curL-1-use+j]);

		}

		umin(add,cev);

	}

	return ans+add;

}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -