답안 #289605

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
289605 2020-09-02T18:54:32 Z Doxeno 쌀 창고 (IOI11_ricehub) C++17
100 / 100
19 ms 1792 KB
#include<bits/stdc++.h>
using namespace std;
long long besthub(int N, int L, int risaie[], long long B){
	long long left=0,right=0;
	long long spesa = 0;
	long long m =1;
	while(right<N-1){
		if(spesa>B){
			spesa+=risaie[left]-risaie[(++left+right)/2];
		}else{
			right++;
			spesa+=risaie[right]-risaie[(left+right)/2];
		//	if(spesa<=B)m=max(,max
		}
		if(spesa<=B)m=max(m,right-left+1);
	}
	return m;
}

Compilation message

ricehub.cpp: In function 'long long int besthub(int, int, int*, long long int)':
ricehub.cpp:9:32: warning: operation on 'left' may be undefined [-Wsequence-point]
    9 |    spesa+=risaie[left]-risaie[(++left+right)/2];
      |                                ^~~~~~
ricehub.cpp:9:32: warning: operation on 'left' may be undefined [-Wsequence-point]
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 0 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 0 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 0 ms 256 KB Output is correct
15 Correct 0 ms 384 KB Output is correct
16 Correct 1 ms 256 KB Output is correct
17 Correct 0 ms 256 KB Output is correct
18 Correct 0 ms 256 KB Output is correct
19 Correct 0 ms 256 KB Output is correct
20 Correct 0 ms 256 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 0 ms 256 KB Output is correct
23 Correct 1 ms 376 KB Output is correct
24 Correct 0 ms 256 KB Output is correct
25 Correct 1 ms 256 KB Output is correct
26 Correct 1 ms 256 KB Output is correct
27 Correct 1 ms 256 KB Output is correct
28 Correct 0 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 256 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 2 ms 384 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 416 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 512 KB Output is correct
2 Correct 3 ms 512 KB Output is correct
3 Correct 17 ms 1792 KB Output is correct
4 Correct 17 ms 1792 KB Output is correct
5 Correct 7 ms 800 KB Output is correct
6 Correct 7 ms 896 KB Output is correct
7 Correct 13 ms 1536 KB Output is correct
8 Correct 13 ms 1536 KB Output is correct
9 Correct 6 ms 768 KB Output is correct
10 Correct 8 ms 768 KB Output is correct
11 Correct 19 ms 1788 KB Output is correct
12 Correct 17 ms 1792 KB Output is correct
13 Correct 10 ms 896 KB Output is correct
14 Correct 9 ms 896 KB Output is correct
15 Correct 13 ms 1408 KB Output is correct
16 Correct 13 ms 1408 KB Output is correct
17 Correct 15 ms 1664 KB Output is correct
18 Correct 15 ms 1664 KB Output is correct
19 Correct 16 ms 1664 KB Output is correct
20 Correct 16 ms 1664 KB Output is correct