답안 #62063

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
62063 2018-07-27T11:31:19 Z aome 쌀 창고 (IOI11_ricehub) C++17
100 / 100
29 ms 15596 KB
#include "ricehub.h"

#include <bits/stdc++.h>

using namespace std;

const int N = 100005;

long long sum[N];

long long get(int l, int r) {
	int mid = (l + r) >> 1;
	if ((r - l + 1) & 1) {
		return sum[r] - sum[mid] - sum[mid - 1] + sum[l - 1];
	}
	else {
		return sum[r] - sum[mid] - sum[mid] + sum[l - 1];
	}	
}

int besthub(int R, int L, int X[], long long B) {
	for (int i = 1; i <= R; ++i) sum[i] = sum[i - 1] + X[i - 1];
	int ptr = 0, res = 0;
	for (int i = 1; i <= R; ++i) {
		while (ptr <= R && get(i, ptr) <= B) ptr++;
		res = max(res, ptr - i);
	}
	return res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 4 ms 460 KB Output is correct
3 Correct 3 ms 460 KB Output is correct
4 Correct 3 ms 584 KB Output is correct
5 Correct 2 ms 584 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 584 KB Output is correct
2 Correct 3 ms 584 KB Output is correct
3 Correct 4 ms 584 KB Output is correct
4 Correct 3 ms 584 KB Output is correct
5 Correct 2 ms 584 KB Output is correct
6 Correct 3 ms 672 KB Output is correct
7 Correct 3 ms 672 KB Output is correct
8 Correct 3 ms 672 KB Output is correct
9 Correct 3 ms 672 KB Output is correct
10 Correct 3 ms 672 KB Output is correct
11 Correct 3 ms 672 KB Output is correct
12 Correct 3 ms 764 KB Output is correct
13 Correct 3 ms 764 KB Output is correct
14 Correct 3 ms 764 KB Output is correct
15 Correct 3 ms 764 KB Output is correct
16 Correct 3 ms 764 KB Output is correct
17 Correct 3 ms 764 KB Output is correct
18 Correct 2 ms 764 KB Output is correct
19 Correct 3 ms 764 KB Output is correct
20 Correct 2 ms 764 KB Output is correct
21 Correct 3 ms 764 KB Output is correct
22 Correct 3 ms 764 KB Output is correct
23 Correct 0 ms 764 KB Output is correct
24 Correct 3 ms 764 KB Output is correct
25 Correct 2 ms 764 KB Output is correct
26 Correct 5 ms 764 KB Output is correct
27 Correct 3 ms 764 KB Output is correct
28 Correct 3 ms 764 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 764 KB Output is correct
2 Correct 3 ms 764 KB Output is correct
3 Correct 3 ms 764 KB Output is correct
4 Correct 3 ms 764 KB Output is correct
5 Correct 3 ms 764 KB Output is correct
6 Correct 4 ms 768 KB Output is correct
7 Correct 3 ms 772 KB Output is correct
8 Correct 3 ms 784 KB Output is correct
9 Correct 3 ms 788 KB Output is correct
10 Correct 3 ms 792 KB Output is correct
11 Correct 2 ms 796 KB Output is correct
12 Correct 3 ms 804 KB Output is correct
13 Correct 3 ms 812 KB Output is correct
14 Correct 4 ms 812 KB Output is correct
15 Correct 2 ms 900 KB Output is correct
16 Correct 5 ms 904 KB Output is correct
17 Correct 3 ms 904 KB Output is correct
18 Correct 3 ms 904 KB Output is correct
19 Correct 2 ms 904 KB Output is correct
20 Correct 2 ms 904 KB Output is correct
21 Correct 3 ms 904 KB Output is correct
22 Correct 3 ms 904 KB Output is correct
23 Correct 4 ms 916 KB Output is correct
24 Correct 4 ms 948 KB Output is correct
25 Correct 5 ms 980 KB Output is correct
26 Correct 4 ms 1024 KB Output is correct
27 Correct 4 ms 1092 KB Output is correct
28 Correct 4 ms 1100 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 1268 KB Output is correct
2 Correct 7 ms 1400 KB Output is correct
3 Correct 25 ms 3468 KB Output is correct
4 Correct 24 ms 4592 KB Output is correct
5 Correct 14 ms 4592 KB Output is correct
6 Correct 15 ms 4632 KB Output is correct
7 Correct 27 ms 5996 KB Output is correct
8 Correct 29 ms 6768 KB Output is correct
9 Correct 11 ms 6768 KB Output is correct
10 Correct 13 ms 6768 KB Output is correct
11 Correct 25 ms 8372 KB Output is correct
12 Correct 26 ms 9424 KB Output is correct
13 Correct 13 ms 9424 KB Output is correct
14 Correct 11 ms 9596 KB Output is correct
15 Correct 24 ms 10624 KB Output is correct
16 Correct 25 ms 11540 KB Output is correct
17 Correct 26 ms 12584 KB Output is correct
18 Correct 21 ms 13528 KB Output is correct
19 Correct 24 ms 14600 KB Output is correct
20 Correct 27 ms 15596 KB Output is correct