# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
28869 | 2017-07-17T11:27:51 Z | aybala | Rice Hub (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
# | Verdict | Execution time | Memory | 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 | - |
# | Verdict | Execution time | Memory | 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 | - |
# | Verdict | Execution time | Memory | 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 | - |