답안 #49776

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
49776 2018-06-03T02:10:19 Z 노영훈(#1276, Diuven) 쌀 창고 (IOI11_ricehub) C++11
68 / 100
1000 ms 2176 KB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const int MX=100010;

int X[MX], n, xmx;
ll S[MX];

ll cost(int l, int r){
	int mid=(l+r)/2;
	ll leftsum = 1LL*X[mid]*(mid-l+1) - (S[mid]-S[l-1]);
	ll rigtsum = (S[r]-S[mid]) - 1LL*X[mid]*(r-mid);
	return leftsum+rigtsum;
}

ll solve(ll maxCost){
	ll ans=0;
	for(int i=1; i<=n; i++)
		for(int j=i; j<=n; j++)
			if(cost(i,j)<=maxCost)
				ans=max(ans, 0LL+j-i+1);
	return ans;
}

int besthub(int R, int L, int XX[], ll B) {
	n=R, xmx=L;
	for(int i=1; i<=n; i++){
		X[i]=XX[i-1];
		S[i]=S[i-1]+X[i];
	}
	return solve(B);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 416 KB Output is correct
4 Correct 2 ms 432 KB Output is correct
5 Correct 3 ms 432 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 472 KB Output is correct
2 Correct 2 ms 548 KB Output is correct
3 Correct 2 ms 548 KB Output is correct
4 Correct 3 ms 624 KB Output is correct
5 Correct 3 ms 744 KB Output is correct
6 Correct 2 ms 744 KB Output is correct
7 Correct 2 ms 744 KB Output is correct
8 Correct 2 ms 744 KB Output is correct
9 Correct 2 ms 752 KB Output is correct
10 Correct 2 ms 752 KB Output is correct
11 Correct 3 ms 752 KB Output is correct
12 Correct 3 ms 752 KB Output is correct
13 Correct 3 ms 752 KB Output is correct
14 Correct 3 ms 752 KB Output is correct
15 Correct 3 ms 752 KB Output is correct
16 Correct 2 ms 752 KB Output is correct
17 Correct 2 ms 752 KB Output is correct
18 Correct 5 ms 752 KB Output is correct
19 Correct 2 ms 752 KB Output is correct
20 Correct 3 ms 752 KB Output is correct
21 Correct 3 ms 752 KB Output is correct
22 Correct 4 ms 752 KB Output is correct
23 Correct 3 ms 752 KB Output is correct
24 Correct 3 ms 752 KB Output is correct
25 Correct 2 ms 752 KB Output is correct
26 Correct 3 ms 752 KB Output is correct
27 Correct 3 ms 752 KB Output is correct
28 Correct 4 ms 752 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 752 KB Output is correct
2 Correct 3 ms 752 KB Output is correct
3 Correct 4 ms 752 KB Output is correct
4 Correct 7 ms 752 KB Output is correct
5 Correct 3 ms 752 KB Output is correct
6 Correct 3 ms 752 KB Output is correct
7 Correct 5 ms 752 KB Output is correct
8 Correct 4 ms 752 KB Output is correct
9 Correct 2 ms 752 KB Output is correct
10 Correct 2 ms 752 KB Output is correct
11 Correct 4 ms 752 KB Output is correct
12 Correct 3 ms 752 KB Output is correct
13 Correct 4 ms 752 KB Output is correct
14 Correct 5 ms 752 KB Output is correct
15 Correct 3 ms 752 KB Output is correct
16 Correct 3 ms 752 KB Output is correct
17 Correct 4 ms 752 KB Output is correct
18 Correct 5 ms 752 KB Output is correct
19 Correct 5 ms 752 KB Output is correct
20 Correct 5 ms 752 KB Output is correct
21 Correct 53 ms 752 KB Output is correct
22 Correct 40 ms 752 KB Output is correct
23 Correct 42 ms 752 KB Output is correct
24 Correct 43 ms 752 KB Output is correct
25 Correct 49 ms 752 KB Output is correct
26 Correct 47 ms 752 KB Output is correct
27 Correct 52 ms 812 KB Output is correct
28 Correct 51 ms 812 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 652 ms 952 KB Output is correct
2 Correct 652 ms 1024 KB Output is correct
3 Execution timed out 1083 ms 2176 KB Time limit exceeded
4 Halted 0 ms 0 KB -