# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
28869 | 2017-07-17T11:27:51 Z | aybala | 쌀 창고 (IOI11_ricehub) | C++11 | 23 ms | 5020 KB |
#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; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 5020 KB | Output is correct |
2 | Incorrect | 0 ms | 5020 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 0 ms | 5020 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 0 ms | 5020 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |