제출 #1247875

#제출 시각아이디문제언어결과실행 시간메모리
1247875LM1쌀 창고 (IOI11_ricehub)C++20
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #define int long long using namespace std; const int N=1e5+5; ll R,L,B,X[N]; ll pr[N],ans=-1e18; ll solve(ll l){ ll l1=l,r1=R; while(l1<r1){ ll mid=(l1+r1+1)/2,k=(l+mid)/2; if(X[k-1]*(k-l+1)-(pr[k]-pr[l-1])+(pr[mid]-pr[k])-(mid-k)*X[k-1]>B)r1=mid-1; else l1=mid; } return l1-l+1; } //int main(){ // cin>>R>>L>>B; // for(int i=0;i<R;i++)cin>>X[i]; // for(int i=0;i<R;i++)pr[i+1]+=pr[i]+X[i]; // for(int i=1;i<=R;i++)ans=max(solve(i),ans); // cout<<ans; //} int besthub(int R,int L,int X[],int B){ for(int i=0;i<R;i++)pr[i+1]+=pr[i]+X[i]; for(int i=1;i<=R;i++)ans=max(solve(i),ans); return ans; }

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

ricehub.cpp:5:1: error: 'll' does not name a type
    5 | ll R,L,B,X[N];
      | ^~
ricehub.cpp:6:1: error: 'll' does not name a type
    6 | ll pr[N],ans=-1e18;
      | ^~
ricehub.cpp:7:1: error: 'll' does not name a type
    7 | ll solve(ll l){
      | ^~
ricehub.cpp: In function 'long long int besthub(long long int, long long int, long long int*, long long int)':
ricehub.cpp:24:29: error: 'pr' was not declared in this scope
   24 |         for(int i=0;i<R;i++)pr[i+1]+=pr[i]+X[i];
      |                             ^~
ricehub.cpp:25:30: error: 'ans' was not declared in this scope; did you mean 'abs'?
   25 |         for(int i=1;i<=R;i++)ans=max(solve(i),ans);
      |                              ^~~
      |                              abs
ricehub.cpp:25:38: error: 'solve' was not declared in this scope
   25 |         for(int i=1;i<=R;i++)ans=max(solve(i),ans);
      |                                      ^~~~~
ricehub.cpp:26:16: error: 'ans' was not declared in this scope; did you mean 'abs'?
   26 |         return ans;
      |                ^~~
      |                abs