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"
#include<bits/stdc++.h>
using namespace std ;
int besthub(int R, int L, int X[], long long B)
{
int mx = 0 ;
int e[R + 10] = {};
for(int i = 0 ; i < R ; i ++)
e[X[i]] ++ ;
for(int i = 1 ; i <= L ; i ++){
int sum = B ;
int ans = 0 ;
int pl = i , pr = i;
int d = 0 ;
while(sum > 0&& pl >= 0){
d ++ ;
pl -- , pr ++ ;
if(e[pl]){
if(sum > d)ans ++ , sum -= d ;
else break;
}
if(e[pr]){
if(sum > d)ans ++ , sum -= d ;
else break;
}
}
mx = max(mx , ans);
}
return mx ;
}
# | 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... |