답안 #898966

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
898966 2024-01-05T10:22:14 Z Muhammad_Aneeq 쌀 창고 (IOI11_ricehub) C++17
100 / 100
14 ms 2660 KB
#include "ricehub.h"
int besthub(int n, int l, int a[], long long b)
{
	int  ans=0;
	long long pre[n+1]={};
	for (int  i=0;i<n;i++)
		pre[i+1]=pre[i]+a[i];
	for (int i=0;i<n;i++)
	{
		int st=0,en=n-i;
		while (st+1<en)
		{
			int mid=(st+en)/2;
			long long g=0;
			int j=i,k=i+mid/2,l=i+mid;
			j++;k++;l++;
			g=pre[l]-pre[k]-1ll*a[k-1]*(l-k)+1ll*a[k-1]*(k-j+1)-(pre[k]-pre[j-1]);
			if (g<=b)
				st=mid;
			else
				en=mid;
		}
		ans=(st+1>ans?st+1:ans);
	}
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 424 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 432 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 0 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 344 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 428 KB Output is correct
23 Correct 0 ms 344 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 344 KB Output is correct
27 Correct 0 ms 600 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 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 440 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 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 0 ms 348 KB Output is correct
15 Correct 1 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 344 KB Output is correct
21 Correct 1 ms 464 KB Output is correct
22 Correct 1 ms 444 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 468 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 604 KB Output is correct
2 Correct 2 ms 592 KB Output is correct
3 Correct 13 ms 2488 KB Output is correct
4 Correct 13 ms 2652 KB Output is correct
5 Correct 6 ms 1116 KB Output is correct
6 Correct 6 ms 1124 KB Output is correct
7 Correct 12 ms 2140 KB Output is correct
8 Correct 12 ms 2236 KB Output is correct
9 Correct 6 ms 1116 KB Output is correct
10 Correct 6 ms 1116 KB Output is correct
11 Correct 13 ms 2592 KB Output is correct
12 Correct 14 ms 2660 KB Output is correct
13 Correct 6 ms 1392 KB Output is correct
14 Correct 6 ms 1216 KB Output is correct
15 Correct 10 ms 1884 KB Output is correct
16 Correct 9 ms 1864 KB Output is correct
17 Correct 11 ms 2396 KB Output is correct
18 Correct 11 ms 2352 KB Output is correct
19 Correct 12 ms 2396 KB Output is correct
20 Correct 12 ms 2336 KB Output is correct