답안 #898802

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
898802 2024-01-05T06:34:02 Z Muhammad_Aneeq 쌀 창고 (IOI11_ricehub) C++17
17 / 100
64 ms 1372 KB
#include <algorithm>
#include "ricehub.h"
using namespace std;
int besthub(int n, int l, int a[], long long b)
{
	long long  ans=0;
	long long pre[n+1]={};
	for (long long  i=0;i<n;i++)
		pre[i+1]=pre[i]+a[i];
	for (long long  i=1;i<=n;i++)
	{
		long long  st=0,en=i;
		while (st+1<en)
		{
			long long  mid=(st+en)/2;
			long long z=pre[i]-pre[mid-1];
			z/=(i-mid+1);
			long long  f=lower_bound(a,a+i,z)-a;
			f++;
			long long g=(pre[i]-pre[f-1])-z*(i-f+1);
			f--;
			g+=(f-mid+1)*z-(pre[f]-pre[mid-1]);
			if (g<=b)
				en=mid;
			else
			st=mid;	
		}
		ans=max(ans,i-en+1);
	}
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 600 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Incorrect 0 ms 348 KB Output isn't correct
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 2 ms 600 KB Output is correct
22 Correct 3 ms 348 KB Output is correct
23 Correct 2 ms 348 KB Output is correct
24 Correct 2 ms 348 KB Output is correct
25 Correct 3 ms 384 KB Output is correct
26 Correct 2 ms 348 KB Output is correct
27 Incorrect 2 ms 348 KB Output isn't correct
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 604 KB Output is correct
2 Correct 7 ms 600 KB Output is correct
3 Correct 36 ms 1372 KB Output is correct
4 Correct 39 ms 1372 KB Output is correct
5 Correct 34 ms 984 KB Output is correct
6 Correct 33 ms 860 KB Output is correct
7 Correct 56 ms 1368 KB Output is correct
8 Correct 55 ms 1372 KB Output is correct
9 Correct 34 ms 856 KB Output is correct
10 Correct 31 ms 860 KB Output is correct
11 Correct 64 ms 1368 KB Output is correct
12 Correct 63 ms 1372 KB Output is correct
13 Incorrect 32 ms 860 KB Output isn't correct
14 Halted 0 ms 0 KB -