답안 #80195

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
80195 2018-10-19T13:49:34 Z farukkastamonuda 쌀 창고 (IOI11_ricehub) C++14
68 / 100
29 ms 2556 KB
#include "ricehub.h"
#include <bits/stdc++.h>
#define fi first
#define se second
#define lo long long 
#define inf 1000000000
#define md 1000000007
#define li 100005
#define mp make_pair
#define pb push_back
using namespace std;
int n,T[10],mx,b,ans;
lo int A[li],pre[li];
bool chechk(lo int l,lo int r){
	int mid=(l+r)/2;
	lo int sum=1ll*A[mid]*(mid-l+1)-(pre[mid]-pre[l-1]);
	sum+=(pre[r]-pre[mid-1])-1ll*A[mid]*(r-mid+1);
	return sum<=b;
}
int besthub(int R,int L,int X[],lo int B){
	n=R;
	for(int i=1;i<=n;i++) A[i]=X[i-1];
	mx=L;
	b=B;
	for(int i=1;i<=n;i++) pre[i]=pre[i-1]+A[i];
	for(int i=1;i<=n;i++){
		int l=i,r=n;
		while(l<=r){
			int mid=(l+r)/2;
			if(chechk(i,mid)) l=mid+1;
			else r=mid-1;
		}
		ans=max(ans,l-i);
	}
	return ans;
}
//~ int main(){
	//~ T[0]=1,T[1]=2,T[3]=10,T[4]=12,T[5]=14;
	//~ int ty=besthub(5,20,T,6);
	//~ printf("%d\n",ty);
	//~ return 0;

//}

# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 508 KB Output is correct
3 Correct 2 ms 508 KB Output is correct
4 Correct 2 ms 508 KB Output is correct
5 Correct 3 ms 508 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 508 KB Output is correct
2 Correct 2 ms 508 KB Output is correct
3 Correct 2 ms 508 KB Output is correct
4 Correct 2 ms 576 KB Output is correct
5 Correct 2 ms 596 KB Output is correct
6 Correct 2 ms 596 KB Output is correct
7 Correct 2 ms 596 KB Output is correct
8 Correct 2 ms 596 KB Output is correct
9 Correct 2 ms 596 KB Output is correct
10 Correct 2 ms 596 KB Output is correct
11 Correct 2 ms 596 KB Output is correct
12 Correct 3 ms 596 KB Output is correct
13 Correct 2 ms 636 KB Output is correct
14 Correct 2 ms 636 KB Output is correct
15 Correct 2 ms 640 KB Output is correct
16 Correct 3 ms 640 KB Output is correct
17 Correct 2 ms 640 KB Output is correct
18 Correct 2 ms 640 KB Output is correct
19 Correct 2 ms 640 KB Output is correct
20 Correct 3 ms 640 KB Output is correct
21 Correct 2 ms 640 KB Output is correct
22 Correct 2 ms 640 KB Output is correct
23 Correct 2 ms 640 KB Output is correct
24 Correct 2 ms 640 KB Output is correct
25 Correct 2 ms 640 KB Output is correct
26 Correct 2 ms 640 KB Output is correct
27 Correct 2 ms 640 KB Output is correct
28 Correct 2 ms 640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 640 KB Output is correct
2 Correct 2 ms 640 KB Output is correct
3 Correct 2 ms 640 KB Output is correct
4 Correct 2 ms 640 KB Output is correct
5 Correct 2 ms 640 KB Output is correct
6 Correct 2 ms 640 KB Output is correct
7 Correct 2 ms 640 KB Output is correct
8 Correct 2 ms 640 KB Output is correct
9 Correct 2 ms 640 KB Output is correct
10 Correct 5 ms 640 KB Output is correct
11 Correct 2 ms 640 KB Output is correct
12 Correct 2 ms 640 KB Output is correct
13 Correct 4 ms 640 KB Output is correct
14 Correct 2 ms 640 KB Output is correct
15 Correct 2 ms 640 KB Output is correct
16 Correct 2 ms 640 KB Output is correct
17 Correct 2 ms 640 KB Output is correct
18 Correct 2 ms 640 KB Output is correct
19 Correct 2 ms 640 KB Output is correct
20 Correct 3 ms 640 KB Output is correct
21 Correct 3 ms 700 KB Output is correct
22 Correct 3 ms 728 KB Output is correct
23 Correct 3 ms 728 KB Output is correct
24 Correct 3 ms 728 KB Output is correct
25 Correct 3 ms 728 KB Output is correct
26 Correct 3 ms 728 KB Output is correct
27 Correct 3 ms 728 KB Output is correct
28 Correct 3 ms 728 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1024 KB Output is correct
2 Correct 7 ms 1024 KB Output is correct
3 Incorrect 29 ms 2556 KB Output isn't correct
4 Halted 0 ms 0 KB -