제출 #28786

#제출 시각아이디문제언어결과실행 시간메모리
28786Nikefor쌀 창고 (IOI11_ricehub)C++98
0 / 100
1000 ms5060 KiB
#include "ricehub.h" int field[10001]; int besthub(int R, int L, int X[], long long B) { for(int i=0; i<R; i++) field[ X[i] ]++; long long optimalGain = 0; for(int i=0; i<L; i++) { long long localGain =0, constraint = 0; for(int j=1; j<=L, constraint+j<=B; j++) { if( (i-j) > 0 && field[i-j]) {constraint+=j; localGain+=field[i-j];} if( (i+j) <= L && field[i+j] && constraint+j<=B) {constraint+=j; localGain+=field[i+j];} } if(localGain>optimalGain) optimalGain = localGain; } return optimalGain ; }

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

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:9:23: warning: left operand of comma operator has no effect [-Wunused-value]
         for(int j=1; j<=L, constraint+j<=B; j++) {
                       ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...