답안 #953921

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
953921 2024-03-26T21:34:38 Z 4QT0R 쌀 창고 (IOI11_ricehub) C++17
100 / 100
13 ms 3752 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long

ll pref[100003];
ll pos[100003];

ll cost(ll l, ll p){
	ll med=(l+p)/2;
	return pref[p]-2*pref[med]+pref[l-1]+(!((l+p)&1))*pos[med];
}

ll besthub(int n, int L, int x[], ll bud){
	for (ll i = 0; i<n; i++){
		pos[i+1]=x[i];
		pref[i+1]=pref[i]+(ll)x[i];
	}
	ll mx=1,p=1;
	for (ll l = 1; l<=n; l++){
		while(p<n && cost(l,p+1)<=bud)p++;
		mx=max(mx,p-l+1);
	}
	return mx;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2496 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2904 KB Output is correct
12 Correct 1 ms 2392 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2392 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2488 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2648 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 1 ms 2396 KB Output is correct
25 Correct 1 ms 2396 KB Output is correct
26 Correct 1 ms 2392 KB Output is correct
27 Correct 1 ms 2396 KB Output is correct
28 Correct 1 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2592 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2392 KB Output is correct
18 Correct 1 ms 2392 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2488 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 1 ms 2392 KB Output is correct
25 Correct 1 ms 2500 KB Output is correct
26 Correct 1 ms 2392 KB Output is correct
27 Correct 1 ms 2392 KB Output is correct
28 Correct 1 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2652 KB Output is correct
2 Correct 2 ms 2652 KB Output is correct
3 Correct 9 ms 3628 KB Output is correct
4 Correct 10 ms 3672 KB Output is correct
5 Correct 5 ms 2908 KB Output is correct
6 Correct 6 ms 3164 KB Output is correct
7 Correct 8 ms 3244 KB Output is correct
8 Correct 8 ms 3276 KB Output is correct
9 Correct 4 ms 2908 KB Output is correct
10 Correct 4 ms 2908 KB Output is correct
11 Correct 10 ms 3676 KB Output is correct
12 Correct 13 ms 3676 KB Output is correct
13 Correct 5 ms 2908 KB Output is correct
14 Correct 5 ms 2908 KB Output is correct
15 Correct 7 ms 3420 KB Output is correct
16 Correct 7 ms 3420 KB Output is correct
17 Correct 8 ms 3368 KB Output is correct
18 Correct 9 ms 3420 KB Output is correct
19 Correct 10 ms 3676 KB Output is correct
20 Correct 9 ms 3752 KB Output is correct