답안 #88010

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
88010 2018-12-03T11:19:45 Z Pajaraja 쌀 창고 (IOI11_ricehub) C++17
100 / 100
22 ms 15972 KB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
int n,l;
long long b,x[100007];
bool provera(int k)
{
	int poc=0,krj=k,med=k/2;
	long long spr=0,spo=0;
	for(int i=0;i<med;i++) spr+=x[i];
	for(int i=med+1;i<krj;i++) spo+=x[i];  
	while(krj<=n)
	{
		long long sum=spo-spr+(k%2==0?x[med]:0);
		if(sum<=b) return true;
		spr-=x[poc];
		spo+=x[krj];
		spr+=x[med];
		poc++;
		krj++;
		med++;
		spo-=x[med];
	}
	return false;
}
int binarna(int l,int r)
{
	if(l==r) return l;
	int s=(l+r+1)/2;
	if(provera(s)) return binarna(s,r);
	return binarna(l,s-1);
}
int besthub(int R, int L, int X[], long long B)
{
	n=R;
	l=L;
	for(int i=0;i<n;i++) x[i]=X[i];
	b=B;
    return binarna(1,n);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 488 KB Output is correct
4 Correct 2 ms 600 KB Output is correct
5 Correct 2 ms 712 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 716 KB Output is correct
2 Correct 2 ms 736 KB Output is correct
3 Correct 2 ms 740 KB Output is correct
4 Correct 2 ms 744 KB Output is correct
5 Correct 2 ms 876 KB Output is correct
6 Correct 2 ms 876 KB Output is correct
7 Correct 2 ms 876 KB Output is correct
8 Correct 2 ms 876 KB Output is correct
9 Correct 0 ms 876 KB Output is correct
10 Correct 2 ms 876 KB Output is correct
11 Correct 2 ms 876 KB Output is correct
12 Correct 2 ms 876 KB Output is correct
13 Correct 2 ms 876 KB Output is correct
14 Correct 2 ms 876 KB Output is correct
15 Correct 2 ms 876 KB Output is correct
16 Correct 2 ms 876 KB Output is correct
17 Correct 2 ms 876 KB Output is correct
18 Correct 2 ms 876 KB Output is correct
19 Correct 1 ms 876 KB Output is correct
20 Correct 2 ms 876 KB Output is correct
21 Correct 0 ms 876 KB Output is correct
22 Correct 2 ms 876 KB Output is correct
23 Correct 2 ms 876 KB Output is correct
24 Correct 2 ms 876 KB Output is correct
25 Correct 2 ms 876 KB Output is correct
26 Correct 2 ms 876 KB Output is correct
27 Correct 2 ms 876 KB Output is correct
28 Correct 2 ms 876 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 876 KB Output is correct
2 Correct 2 ms 876 KB Output is correct
3 Correct 2 ms 876 KB Output is correct
4 Correct 2 ms 884 KB Output is correct
5 Correct 2 ms 908 KB Output is correct
6 Correct 2 ms 912 KB Output is correct
7 Correct 2 ms 916 KB Output is correct
8 Correct 2 ms 924 KB Output is correct
9 Correct 2 ms 948 KB Output is correct
10 Correct 2 ms 952 KB Output is correct
11 Correct 2 ms 956 KB Output is correct
12 Correct 3 ms 964 KB Output is correct
13 Correct 2 ms 972 KB Output is correct
14 Correct 2 ms 980 KB Output is correct
15 Correct 2 ms 1004 KB Output is correct
16 Correct 2 ms 1008 KB Output is correct
17 Correct 2 ms 1012 KB Output is correct
18 Correct 2 ms 1020 KB Output is correct
19 Correct 2 ms 1028 KB Output is correct
20 Correct 2 ms 1032 KB Output is correct
21 Correct 3 ms 1044 KB Output is correct
22 Correct 3 ms 1084 KB Output is correct
23 Correct 3 ms 1108 KB Output is correct
24 Correct 2 ms 1140 KB Output is correct
25 Correct 3 ms 1220 KB Output is correct
26 Correct 3 ms 1220 KB Output is correct
27 Correct 3 ms 1252 KB Output is correct
28 Correct 3 ms 1292 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 1588 KB Output is correct
2 Correct 6 ms 1724 KB Output is correct
3 Correct 19 ms 3908 KB Output is correct
4 Correct 20 ms 4844 KB Output is correct
5 Correct 10 ms 4844 KB Output is correct
6 Correct 10 ms 5000 KB Output is correct
7 Correct 17 ms 6332 KB Output is correct
8 Correct 17 ms 7104 KB Output is correct
9 Correct 10 ms 7104 KB Output is correct
10 Correct 10 ms 7104 KB Output is correct
11 Correct 21 ms 8712 KB Output is correct
12 Correct 22 ms 9776 KB Output is correct
13 Correct 11 ms 9776 KB Output is correct
14 Correct 11 ms 9968 KB Output is correct
15 Correct 17 ms 11120 KB Output is correct
16 Correct 16 ms 11780 KB Output is correct
17 Correct 19 ms 12952 KB Output is correct
18 Correct 19 ms 13896 KB Output is correct
19 Correct 20 ms 14968 KB Output is correct
20 Correct 20 ms 15972 KB Output is correct