제출 #224629

#제출 시각아이디문제언어결과실행 시간메모리
224629Amy313쌀 창고 (IOI11_ricehub)C++14
컴파일 에러
0 ms0 KiB
#include "ricehub.h" #include<bits/stdc++.h> int besthub(int R, int L, int X[], long long B) { int r, maxi= -1, cp = B, c, a; for(int i=0; i<L; i++) { c = 0; r = i; cp = B; for(int j=0; j<R; j++) { a = abs(i-R[j]); if(a<=cp) { cp-=a; c++: } else { break; } } maxi = max(maxi, c); } return maxi; }

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

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:13:17: error: invalid types 'int[int]' for array subscript
    a = abs(i-R[j]);
                 ^
ricehub.cpp:17:8: error: expected ';' before ':' token
     c++:
        ^
ricehub.cpp:24:10: error: 'max' was not declared in this scope
   maxi = max(maxi, c);
          ^~~
ricehub.cpp:24:10: note: suggested alternative:
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from ricehub.cpp:2:
/usr/include/c++/7/bits/stl_algo.h:3468:5: note:   'std::max'
     max(initializer_list<_Tp> __l, _Compare __comp)
     ^~~