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<bits/stdc++.h>
#include "ricehub.h"
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
int besthub(int n, int l, int x[], ll b){
int ans = 0;
for(int mid = 0; mid < n; mid++){
int cnt = 1, l = mid - 1, r = mid + 1, av = b;
while(b && (l >= 0 || r < n)){
int dl = (l >= 0 ? x[mid] - x[l] : INF);
int dr = (r < n ? x[r] - x[mid] : INF);
if(av - min(dl, dr) < 0) break;
av -= min(dl, dr);
if(dl < dr) l--;
else r++;
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... |