Submission #355594

#TimeUsernameProblemLanguageResultExecution timeMemory
355594David_MRice Hub (IOI11_ricehub)C++14
Compilation error
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++)x[i]=X[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 (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:9:25: error: 'x' was not declared in this scope
    9 |  for (int i=0; i<R; i++)x[i]=X[i],pref[i]=X[i]+(i>0)*pref[i-1];
      |                         ^
ricehub.cpp:12:7: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   12 |    m=l+r>>1;
      |      ~^~
ricehub.cpp:14:20: error: 'x' was not declared in this scope
   14 |    if((l+r+1)&1)b+=x[m];
      |                    ^