Submission #655194

#TimeUsernameProblemLanguageResultExecution timeMemory
655194PanTkdRice Hub (IOI11_ricehub)C++14
Compilation error
0 ms0 KiB
#include "ricehub.h" int besthub(int R, int L, int X[], long long B) { for(ll i = R;i>=1;i--){ for(ll j = 0;j<R-i;j++){ ll cost = 0; ll med = i/2+j; for(ll k = j ;k<=j+i-1 && k<=R;k++){ cost+= abs(X[med]-X[k]); } if(cost<=B) return i; } } }

Compilation message (stderr)

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:5:7: error: 'll' was not declared in this scope
    5 |   for(ll i = R;i>=1;i--){
      |       ^~
ricehub.cpp:5:16: error: 'i' was not declared in this scope
    5 |   for(ll i = R;i>=1;i--){
      |                ^
ricehub.cpp:6:11: error: expected ';' before 'j'
    6 |     for(ll j = 0;j<R-i;j++){
      |           ^~
      |           ;
ricehub.cpp:6:18: error: 'j' was not declared in this scope
    6 |     for(ll j = 0;j<R-i;j++){
      |                  ^
ricehub.cpp:7:9: error: expected ';' before 'cost'
    7 |       ll cost = 0;
      |         ^~~~~
      |         ;
ricehub.cpp:8:9: error: expected ';' before 'med'
    8 |       ll med = i/2+j;
      |         ^~~~
      |         ;
ricehub.cpp:9:13: error: expected ';' before 'k'
    9 |       for(ll k = j ;k<=j+i-1 && k<=R;k++){
      |             ^~
      |             ;
ricehub.cpp:9:21: error: 'k' was not declared in this scope
    9 |       for(ll k = j ;k<=j+i-1 && k<=R;k++){
      |                     ^
ricehub.cpp:10:9: error: 'cost' was not declared in this scope
   10 |         cost+= abs(X[med]-X[k]);
      |         ^~~~
ricehub.cpp:10:22: error: 'med' was not declared in this scope
   10 |         cost+= abs(X[med]-X[k]);
      |                      ^~~
ricehub.cpp:10:16: error: 'abs' was not declared in this scope
   10 |         cost+= abs(X[med]-X[k]);
      |                ^~~
ricehub.cpp:12:10: error: 'cost' was not declared in this scope
   12 |       if(cost<=B)
      |          ^~~~