# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
28879 | aybala | Rice Hub (IOI11_ricehub) | C++11 | 1000 ms | 5020 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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--){
for(k=i;k<=L;k++){
top=0,say=0;
for(l=i; l>=j; l--){
top+=(long long)(i-l)*xx[l];
say+=xx[l];
}
for(l=i; l<=k; l++){
top+=(long long)(l-i)*xx[l];
say+=xx[l];
}
if(top<=B && say>ans)
ans=say;
}
}
if(top<=B && say>ans)
ans=say;
}*/
int i,j,k,l;
int ric[10003];
for(i=1;i<10003;i++){
ric[i]=0;
}
for(i=0;i<R;i++){
ric[X[i]]++;
}
int ans=0,anss=0;
for(i=1;i<=L;i++){
for(j=i;j>=1;j--){
for(k=i;k<=L;k++){
long long top=0;
int say=0;
for(l=i-1;l>=j;l--){
top+=(long long)(i-l)*ric[l];
say+=ric[l];
if(top>B)
break;
}
for(l=i;l<=k;l++){
top+=(long long)(l-i)*ric[l];
say+=ric[l];
if(top>B)
break;
}
if(top<=B && say>ans){
ans=say;
}
}
}
}
R=ans;
return R;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |