답안 #355596

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
355596 2021-01-22T19:07:34 Z David_M 쌀 창고 (IOI11_ricehub) C++14
100 / 100
16 ms 1516 KB
#include "ricehub.h"
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=100005;
ll ans, pref[N], l, r, m, b;
int besthub(int R,int L,int X[],ll B){
	for (int i=0; i<R; i++)pref[i]=X[i]+(i>0)*pref[i-1];
	for (r=0; r<R; r++){
		while(l<r){
			m=l+r>>1;
			b=pref[r]+(l>0)*pref[l-1]-(pref[m]<<1);
			if((l+r+1)&1)b+=X[m];			
			if(b<=B)break;
			l++;
		}
		ans=max(ans, r-l+1);
	}
	return ans;
}

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:11:7: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   11 |    m=l+r>>1;
      |      ~^~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 0 ms 364 KB Output is correct
13 Correct 0 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 0 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 1 ms 364 KB Output is correct
23 Correct 1 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 1 ms 364 KB Output is correct
26 Correct 1 ms 364 KB Output is correct
27 Correct 1 ms 364 KB Output is correct
28 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 1 ms 364 KB Output is correct
23 Correct 1 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 1 ms 364 KB Output is correct
26 Correct 1 ms 364 KB Output is correct
27 Correct 1 ms 364 KB Output is correct
28 Correct 2 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 640 KB Output is correct
2 Correct 3 ms 620 KB Output is correct
3 Correct 16 ms 1516 KB Output is correct
4 Correct 16 ms 1516 KB Output is correct
5 Correct 7 ms 876 KB Output is correct
6 Correct 7 ms 876 KB Output is correct
7 Correct 14 ms 1516 KB Output is correct
8 Correct 14 ms 1516 KB Output is correct
9 Correct 7 ms 876 KB Output is correct
10 Correct 7 ms 876 KB Output is correct
11 Correct 16 ms 1516 KB Output is correct
12 Correct 16 ms 1516 KB Output is correct
13 Correct 7 ms 876 KB Output is correct
14 Correct 8 ms 876 KB Output is correct
15 Correct 12 ms 1260 KB Output is correct
16 Correct 12 ms 1260 KB Output is correct
17 Correct 14 ms 1388 KB Output is correct
18 Correct 14 ms 1388 KB Output is correct
19 Correct 15 ms 1388 KB Output is correct
20 Correct 15 ms 1388 KB Output is correct