답안 #61013

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
61013 2018-07-25T06:00:34 Z nvmdava 쌀 창고 (IOI11_ricehub) C++17
68 / 100
1000 ms 1004 KB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;


bool price(int X[], int l,int r, long long B){
	
	int i;
	long long p = 0;
	int m = (r + l) / 2;
	
	for(i = l; i <m ; i++){
		p +=(long long)(X[m] - X[i]);
	}
	
	for(i = m + 1; i <=r ; i++){
		p +=(long long)(X[i] - X[m]);
	}
	
	if(p <= B){
		return 1;
	} else {
		return 0;
	}
	
}

int besthub(int n, int L, int X[], long long B)
{
	int l = 0, r = 0, m,dif = -1,i;
	for(i = 0; i < n;i++){
		l = i; r = n ;
		while(l + 1 != r){
			m = (l+r) / 2;
			if(price(X,i,m,B)){
				l = m;
			} else {
				r = m;
			}
		}
		dif = max(dif , r - i);
	}
	return dif;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 1 ms 356 KB Output is correct
3 Correct 3 ms 432 KB Output is correct
4 Correct 2 ms 464 KB Output is correct
5 Correct 2 ms 464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 552 KB Output is correct
2 Correct 2 ms 552 KB Output is correct
3 Correct 2 ms 552 KB Output is correct
4 Correct 3 ms 552 KB Output is correct
5 Correct 3 ms 552 KB Output is correct
6 Correct 4 ms 552 KB Output is correct
7 Correct 3 ms 552 KB Output is correct
8 Correct 2 ms 572 KB Output is correct
9 Correct 3 ms 572 KB Output is correct
10 Correct 2 ms 572 KB Output is correct
11 Correct 3 ms 572 KB Output is correct
12 Correct 3 ms 572 KB Output is correct
13 Correct 2 ms 572 KB Output is correct
14 Correct 2 ms 572 KB Output is correct
15 Correct 3 ms 572 KB Output is correct
16 Correct 2 ms 572 KB Output is correct
17 Correct 2 ms 572 KB Output is correct
18 Correct 2 ms 624 KB Output is correct
19 Correct 3 ms 624 KB Output is correct
20 Correct 3 ms 624 KB Output is correct
21 Correct 3 ms 624 KB Output is correct
22 Correct 3 ms 624 KB Output is correct
23 Correct 4 ms 624 KB Output is correct
24 Correct 4 ms 624 KB Output is correct
25 Correct 5 ms 624 KB Output is correct
26 Correct 5 ms 624 KB Output is correct
27 Correct 4 ms 624 KB Output is correct
28 Correct 4 ms 624 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 624 KB Output is correct
2 Correct 2 ms 624 KB Output is correct
3 Correct 8 ms 624 KB Output is correct
4 Correct 9 ms 624 KB Output is correct
5 Correct 5 ms 624 KB Output is correct
6 Correct 3 ms 624 KB Output is correct
7 Correct 4 ms 624 KB Output is correct
8 Correct 4 ms 624 KB Output is correct
9 Correct 3 ms 624 KB Output is correct
10 Correct 3 ms 624 KB Output is correct
11 Correct 6 ms 624 KB Output is correct
12 Correct 4 ms 624 KB Output is correct
13 Correct 8 ms 624 KB Output is correct
14 Correct 9 ms 624 KB Output is correct
15 Correct 5 ms 624 KB Output is correct
16 Correct 3 ms 624 KB Output is correct
17 Correct 5 ms 624 KB Output is correct
18 Correct 6 ms 624 KB Output is correct
19 Correct 8 ms 624 KB Output is correct
20 Correct 9 ms 624 KB Output is correct
21 Correct 33 ms 632 KB Output is correct
22 Correct 33 ms 632 KB Output is correct
23 Correct 143 ms 632 KB Output is correct
24 Correct 144 ms 632 KB Output is correct
25 Correct 174 ms 748 KB Output is correct
26 Correct 182 ms 748 KB Output is correct
27 Correct 110 ms 748 KB Output is correct
28 Correct 120 ms 748 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 221 ms 748 KB Output is correct
2 Correct 231 ms 748 KB Output is correct
3 Execution timed out 1054 ms 1004 KB Time limit exceeded
4 Halted 0 ms 0 KB -