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>
using namespace std;
#include "ricehub.h"
using ll = long long;
int besthub(int n, int L, int a[], long long k) {
int l = 0, r = 0, ans = 1;
ll c = 0;
while (r < n) {
if (c <= k) {
ans = max(ans, r - l + 1);
r++;
if (r >= n) break;
c += a[r] - a[(r + l) / 2];
} else {
l++;
c -= a[(r + l + 1) / 2] - a[l - 1];
}
}
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... |