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;
#define ll long long
const int N = 1e5 + 5;
int a[N];
int b;
int besthub(int n, int L, int X[], ll B){
int ans = 0, cur = 0, cnt = 0;
for(int i = 0; i < n; ++i)
a[i] = X[i];
for(int i = 0; i < n; ++i)
{
int l = i, r = i + 1;
cur = 0,cnt = 0;
while(l >= 0 || r < n){
if((l >= 0 && a[i] - a[l] < a[r] - a[i]) || (r >= n)){
cur += a[i] - a[l];
--l;
}
else
{
cur += a[r] - a[i];
++r;
}
if(cur > B)
{
break;
}
cnt++;
}
ans = max(ans,cnt);
}
return ans;
}
# | 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... |