답안 #655194

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
655194 2022-11-03T14:18:03 Z PanTkd 쌀 창고 (IOI11_ricehub) C++14
컴파일 오류
0 ms 0 KB
#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

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)
      |          ^~~~