Submission #614007

#TimeUsernameProblemLanguageResultExecution timeMemory
614007chirathnirodhaRice Hub (IOI11_ricehub)C++17
Compilation error
0 ms0 KiB
#include "ricehub.h" #include<bits/stdc++.h> using namespace std; #define PB push_back typedef long long ll; int besthub(int R, int L, int X[], long long B){ int a=0;int b=0; int ans=1; ll curcos=0; while(a<R && b<R){ int pm=(a+b)/2; if(curcos<=B){ ans=max(ans,b-a+1); if(b==n-1)break; b++; curcos+=X[b]-X[pm]; } else{ a++; curcos-=X[pm]-X[b]; } int nm=(a+b)/2; curcos+=(X[nm]-X[pm])*((nm-a)-(b-pm)); } return ans; }

Compilation message (stderr)

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:15:13: error: 'n' was not declared in this scope
   15 |       if(b==n-1)break;
      |             ^