답안 #917817

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
917817 2024-01-28T21:06:28 Z Nonoze 쌀 창고 (IOI11_ricehub) C++17
100 / 100
13 ms 3832 KB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;

int besthub(int R, int L, int X[], long long B)
{
	#define int long long
	int n=R, l=L, b=B;
	int ans=1;
	int sum=0;
	int beg=0;
	for (int i=0; i<n; i++) {
		sum+=X[i];
		sum-=X[beg+(i-beg)/2];
		while (sum>B) {
			sum+=X[beg];
			sum-=X[beg+(i-beg)/2+(i-beg)%2];
			beg++;
		}
		ans=max(ans, i-beg+1);
	}
	return ans;
}

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:8:11: warning: unused variable 'l' [-Wunused-variable]
    8 |  int n=R, l=L, b=B;
      |           ^
ricehub.cpp:8:16: warning: unused variable 'b' [-Wunused-variable]
    8 |  int n=R, l=L, b=B;
      |                ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 600 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 452 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 0 ms 452 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 452 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 600 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 1 ms 480 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 600 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Correct 9 ms 3676 KB Output is correct
4 Correct 9 ms 3676 KB Output is correct
5 Correct 5 ms 2904 KB Output is correct
6 Correct 4 ms 2908 KB Output is correct
7 Correct 8 ms 3420 KB Output is correct
8 Correct 9 ms 3420 KB Output is correct
9 Correct 4 ms 2908 KB Output is correct
10 Correct 4 ms 2908 KB Output is correct
11 Correct 10 ms 3832 KB Output is correct
12 Correct 10 ms 3676 KB Output is correct
13 Correct 5 ms 2908 KB Output is correct
14 Correct 5 ms 2940 KB Output is correct
15 Correct 8 ms 3416 KB Output is correct
16 Correct 7 ms 3416 KB Output is correct
17 Correct 8 ms 3416 KB Output is correct
18 Correct 9 ms 3420 KB Output is correct
19 Correct 9 ms 3676 KB Output is correct
20 Correct 13 ms 3672 KB Output is correct