답안 #1071861

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1071861 2024-08-23T11:57:11 Z LIF 쌀 창고 (IOI11_ricehub) C++14
100 / 100
18 ms 7772 KB
#include "ricehub.h"
#include<bits/stdc++.h>
using namespace std;
long long int a[300005];
long long int su[300005];
long long int cal(int ll,int rr)
{
	int len = rr - ll +1;
	if(len %2 == 0)
	{
		int suf = (ll+rr+1) / 2;
		long long int ans = su[rr] - su[suf-1] - su[suf-1] + su[ll-1];
		return ans;
	}
	else
	{
		int mid = (ll+rr)/2;
		long long int ans = su[rr] - su[mid] - su[mid-1] + su[ll-1];
		return ans;
	}
}
int besthub(int R, int L, int X[], long long B)
{
  for(int i=1;i<=R;i++)a[i] = X[i-1];
  for(int i=1;i<=R;i++)su[i] = su[i-1] + a[i];
	int l = 1;
	int r = 1;
	int maxnlen = -1;
	while(r<=R)
	{
		if(cal(l,r) > B)l++;
		else 
		{
			maxnlen = max(maxnlen,r-l+1);
			r++;
		}
	}
  return maxnlen;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4700 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
14 Correct 1 ms 4696 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 1 ms 4444 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 2 ms 4444 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4540 KB Output is correct
21 Correct 2 ms 4444 KB Output is correct
22 Correct 1 ms 4444 KB Output is correct
23 Correct 1 ms 4444 KB Output is correct
24 Correct 1 ms 4444 KB Output is correct
25 Correct 1 ms 4440 KB Output is correct
26 Correct 1 ms 4444 KB Output is correct
27 Correct 1 ms 4492 KB Output is correct
28 Correct 1 ms 4444 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4440 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4440 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4440 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 1 ms 4444 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 1 ms 4444 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4544 KB Output is correct
21 Correct 1 ms 4552 KB Output is correct
22 Correct 1 ms 4444 KB Output is correct
23 Correct 1 ms 4444 KB Output is correct
24 Correct 1 ms 4444 KB Output is correct
25 Correct 1 ms 4444 KB Output is correct
26 Correct 1 ms 4444 KB Output is correct
27 Correct 1 ms 4444 KB Output is correct
28 Correct 1 ms 4444 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4700 KB Output is correct
2 Correct 4 ms 4696 KB Output is correct
3 Correct 13 ms 7772 KB Output is correct
4 Correct 10 ms 3416 KB Output is correct
5 Correct 8 ms 1628 KB Output is correct
6 Correct 5 ms 1628 KB Output is correct
7 Correct 16 ms 3176 KB Output is correct
8 Correct 8 ms 7512 KB Output is correct
9 Correct 7 ms 7004 KB Output is correct
10 Correct 4 ms 7004 KB Output is correct
11 Correct 12 ms 7660 KB Output is correct
12 Correct 11 ms 3420 KB Output is correct
13 Correct 7 ms 7004 KB Output is correct
14 Correct 9 ms 7004 KB Output is correct
15 Correct 9 ms 5688 KB Output is correct
16 Correct 14 ms 7516 KB Output is correct
17 Correct 8 ms 2908 KB Output is correct
18 Correct 18 ms 2908 KB Output is correct
19 Correct 18 ms 3164 KB Output is correct
20 Correct 10 ms 3164 KB Output is correct