Submission #355597

#TimeUsernameProblemLanguageResultExecution timeMemory
355597David_MRice Hub (IOI11_ricehub)C++14
Compilation error
0 ms0 KiB
#include "ricehub.h" #include<bits/stdc++.h> using namespace std; int besthub(int R,int L,int X[],ll B){ long long ans, pref[100005], l, r, m, b; for (int i=0; i<R; i++)pref[i]=X[i]+(!!i)*pref[i-1]; for (r=0; r<R; r++){ while(l<r){ m=l+r>>1; b=pref[r]+(!!l)*pref[l-1]-(pref[m]<<1); if((l+r+1)&1)b+=X[m]; if(b<=B)break; l++; } if(r-l>ans)ans=r-l; } return ans+1; }

Compilation message (stderr)

ricehub.cpp:4:33: error: 'll' has not been declared
    4 | int besthub(int R,int L,int X[],ll B){
      |                                 ^~
ricehub.cpp: In function 'int besthub(int, int, int*, int)':
ricehub.cpp:9:7: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
    9 |    m=l+r>>1;
      |      ~^~