#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int besthub(int n, int l, int x[], ll b) {
vector<ll> v(n);
for (int i=0; i<n; i++) v[i]=x[i]+(i?v[i-1]:0);
auto get = [&](int s, int e) { return v[e]-(s?v[s-1]:0); };
int mx=0;
for (int i=0; i<n; i++) {
int s=i, e=n-1;
while (s<e) {
int m=(s+e+1)/2;
if (get((s+m+1)/2, m)-get(s, (s+m)/2)>b) e=m-1;
else s=m;
}
mx=max(mx, s-i+1);
}
return mx;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
308 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
588 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |