#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <iterator>
using namespace std;
int besthub(int R, int L, int X[], long long B)
{
assert(0);
int p = 0, q = 0, res = 0;
long long c = 0;
for(int i = 0; i < R; i++)
{
if(i)
c += 1LL * ((i - p) - (q - i)) * (X[i] - X[i - 1]);
while(c > B)
{
assert(p < R);
c -= X[i] - X[p++];
}
while(q < R && (X[q] - X[i] <= X[i] - X[p] || c + X[q] - X[i] <= B))
{
c += X[q++] - X[i];
if(c > B)
{
assert(p < R);
c -= X[i] - X[p++];
assert(c <= B);
}
}
assert(c <= B && p <= i && i < q);
res = max(res, q - p);
}
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
632 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
780 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
9 ms |
900 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |