#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
int besthub(int n, int m, int a[], long long x) {
int mx = 0, l = 1, r = 0;
auto recal = [&](){
long long sum = 0;
int ll = l, rr = r;
while (ll < rr) sum += a[rr--] + a[ll++];
return sum;
};
while (r < n) {
r++;
while (recal() > x) l++;
mx = max(mx, r - l + 1);
}
return mx;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
448 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
608 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |