제출 #355595

#제출 시각아이디문제언어결과실행 시간메모리
355595David_M쌀 창고 (IOI11_ricehub)C++14
컴파일 에러
0 ms0 KiB
#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){
	bb=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;
}

컴파일 시 표준 에러 (stderr) 메시지

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:8:2: error: 'bb' was not declared in this scope; did you mean 'b'?
    8 |  bb=B;
      |  ^~
      |  b
ricehub.cpp:12:7: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   12 |    m=l+r>>1;
      |      ~^~