Submission #13482

# Submission time Handle Problem Language Result Execution time Memory
13482 2015-02-21T21:47:02 Z ainta Rice Hub (IOI11_ricehub) C++
0 / 100
0 ms 4988 KB
#include "ricehub.h"

int besthub(int R, int L, int X[], long long B)
{
	int i, be, ed, t, Res = 0;
	long long S = 0;
	for (i = 0; i < R; i++){
		if (i == 0)be = 0, ed = 0, S = 0;
		if (ed < i)be = ed = i, S = 0;
		t = i * 2 - ed - 2;
		if (be == t){
			S -= (X[i] - X[be]);
			be++;
		}
		t = i * 2 - ed - 1;
		if (be == t){
			S -= (X[i] - X[be]);
			be++;
		}
		while (be - 1 >= 0 && ed + 1 < R){
			if (S + X[ed + 1] - X[be - 1] > B)break;
			S += X[ed + 1] - X[be - 1];
			be--, ed++;
		}
		if (ed + 1 < R && S + X[ed + 1] - X[i]){
			ed++;
			S += X[ed + 1] - X[i];
		}
		if (Res < ed - be + 1)Res = ed - be + 1;
	}
	return Res;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 4988 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 4988 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 4988 KB Output is correct
2 Incorrect 0 ms 4988 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 4988 KB Output is correct
2 Incorrect 0 ms 4988 KB Output isn't correct
3 Halted 0 ms 0 KB -