Submission #64673

#TimeUsernameProblemLanguageResultExecution timeMemory
64673AbelyanRice Hub (IOI11_ricehub)C++17
Compilation error
0 ms0 KiB
#include "ricehub.h" #include <bits/stdc++.h> typedef long long ll; const int N=100050; ll sum[N]; ll sm(int l, int r){ return sum[r]-sum[l-1]; } int besthub(int n, int l, int x[], ll b) { int i; for(i=1;i<=n;i++) sum[i]=sum[i-1]+x[i]; int r=n,l=1,mid,ans=1; while(top>=bot) { mid=(l+r)/2; bool ok=0; for(i=mid;i<=n;i++) { int L=i-mid+1; int R=i; int M=(L+R)/2; ll cost=(ll)(M-L+1)*x[M]-sm(L,M); cost+=get(M,R)-(ll)(R-M+1)*x[M]; if(cost<=b){ ok=1;break;} } if(ok) ans=mid,l=mid+1; else r=mid-1; } return ans; }

Compilation message (stderr)

ricehub.cpp: In function 'int besthub(int, int, int*, ll)':
ricehub.cpp:13:10: error: declaration of 'int l' shadows a parameter
  int r=n,l=1,mid,ans=1;
          ^
ricehub.cpp:14:8: error: 'top' was not declared in this scope
  while(top>=bot)
        ^~~
ricehub.cpp:14:13: error: 'bot' was not declared in this scope
  while(top>=bot)
             ^~~
ricehub.cpp:14:13: note: suggested alternative: 'abort'
  while(top>=bot)
             ^~~
             abort
ricehub.cpp:24:10: error: 'get' was not declared in this scope
    cost+=get(M,R)-(ll)(R-M+1)*x[M];
          ^~~
ricehub.cpp:24:10: note: suggested alternative:
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from ricehub.cpp:2:
/usr/include/c++/7/tuple:1361:5: note:   'std::get'
     get(const tuple<_Types...>& __t) noexcept
     ^~~