제출 #28869

#제출 시각아이디문제언어결과실행 시간메모리
28869aybalaRice Hub (IOI11_ricehub)C++11
0 / 100
23 ms5020 KiB
#include "ricehub.h" int besthub(int R, int L, int X[], long long B) { int i,j,k,l; int xx[103]; for(i=1;i<=L;i++){ xx[i]=0; } for(i=0;i<R;i++){ xx[X[i]]++; } int ans=0; for(i=1;i<=L;i++){ long long top=0,say=0; for(j=i-1;j>=1;j--){ if(xx[j]!=0){ top+=(long long)(i-j)*xx[j]; say+=xx[j]; if(top<=B && say>ans) ans=say; } for(k=i;k<=L;k++){ if(xx[k]!=0){ top+=(long long)(k-i)*xx[k]; say+=xx[k]; if(top<=B && say>ans) ans=say; } } top=0,say=0; } if(top<=B && say>ans) ans=say; } R=ans; return R; }

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

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:5:12: warning: unused variable 'l' [-Wunused-variable]
  int i,j,k,l;
            ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...