답안 #224522

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
224522 2020-04-18T09:54:34 Z T0p_ 쌀 창고 (IOI11_ricehub) C++14
68 / 100
1000 ms 1792 KB
#include <bits/stdc++.h>
#include "ricehub.h"
using namespace std;

int besthub(int R, int L, int X[], long long B)
{
	int ans = 0;
	for(int i=0 ; i<R ; i++)
	{
		long long temp = B;
		int l=i-1, r=i+1, now = 0;
		while(l >= 0 && r < R)
		{
			if(temp < X[i] - X[l] && temp < X[r] - X[i]) break ;
			if(X[i] - X[l] <= X[r] - X[i])
			{
				temp -= (X[i] - X[l]);
				l--;
				now++;
			}
			else
			{
				temp -= (X[r] - X[i]);
				r++;
				now++;
			}
		}
		while(l >= 0)
		{
			if(temp < X[i] - X[l]) break ;
			temp -= (X[i] - X[l]);
			l--;
			now++;
		}
		while(r < R)
		{
			if(temp < X[r] - X[i]) break ;
			temp -= (X[r] - X[i]);
			r++;
			now++;
		}
		ans = max(ans, now+1);
	}
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 4 ms 256 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 4 ms 384 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 4 ms 256 KB Output is correct
14 Correct 5 ms 256 KB Output is correct
15 Correct 4 ms 384 KB Output is correct
16 Correct 4 ms 384 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 5 ms 256 KB Output is correct
19 Correct 5 ms 256 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 5 ms 256 KB Output is correct
22 Correct 5 ms 384 KB Output is correct
23 Correct 5 ms 256 KB Output is correct
24 Correct 6 ms 384 KB Output is correct
25 Correct 5 ms 384 KB Output is correct
26 Correct 6 ms 384 KB Output is correct
27 Correct 5 ms 384 KB Output is correct
28 Correct 5 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 288 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 7 ms 384 KB Output is correct
14 Correct 6 ms 384 KB Output is correct
15 Correct 6 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 7 ms 384 KB Output is correct
18 Correct 7 ms 384 KB Output is correct
19 Correct 8 ms 384 KB Output is correct
20 Correct 8 ms 384 KB Output is correct
21 Correct 8 ms 384 KB Output is correct
22 Correct 8 ms 384 KB Output is correct
23 Correct 53 ms 384 KB Output is correct
24 Correct 51 ms 384 KB Output is correct
25 Correct 97 ms 384 KB Output is correct
26 Correct 97 ms 384 KB Output is correct
27 Correct 31 ms 384 KB Output is correct
28 Correct 31 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 384 KB Output is correct
2 Correct 11 ms 512 KB Output is correct
3 Execution timed out 1092 ms 1792 KB Time limit exceeded
4 Halted 0 ms 0 KB -