제출 #614006

#제출 시각아이디문제언어결과실행 시간메모리
614006chirathnirodha쌀 창고 (IOI11_ricehub)C++17
컴파일 에러
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<n && b<n){ 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; }

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

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:11:11: error: 'n' was not declared in this scope
   11 |   while(a<n && b<n){
      |           ^