#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>
#include "ricehub.h"
using namespace std;
int besthub(int R, int L, int X[], long long B)
{
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)
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];
while(c > B)
c -= X[i] - X[p++];
res = max(res, q - p);
}
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
488 KB |
Output is correct |
3 |
Correct |
3 ms |
488 KB |
Output is correct |
4 |
Correct |
2 ms |
500 KB |
Output is correct |
5 |
Correct |
2 ms |
592 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
592 KB |
Output is correct |
2 |
Correct |
2 ms |
592 KB |
Output is correct |
3 |
Correct |
2 ms |
592 KB |
Output is correct |
4 |
Correct |
3 ms |
592 KB |
Output is correct |
5 |
Correct |
2 ms |
592 KB |
Output is correct |
6 |
Correct |
2 ms |
592 KB |
Output is correct |
7 |
Correct |
2 ms |
592 KB |
Output is correct |
8 |
Correct |
2 ms |
592 KB |
Output is correct |
9 |
Correct |
2 ms |
592 KB |
Output is correct |
10 |
Correct |
2 ms |
592 KB |
Output is correct |
11 |
Correct |
3 ms |
592 KB |
Output is correct |
12 |
Correct |
3 ms |
592 KB |
Output is correct |
13 |
Correct |
3 ms |
592 KB |
Output is correct |
14 |
Correct |
2 ms |
592 KB |
Output is correct |
15 |
Correct |
3 ms |
592 KB |
Output is correct |
16 |
Correct |
2 ms |
592 KB |
Output is correct |
17 |
Correct |
3 ms |
592 KB |
Output is correct |
18 |
Correct |
2 ms |
592 KB |
Output is correct |
19 |
Correct |
3 ms |
592 KB |
Output is correct |
20 |
Correct |
2 ms |
592 KB |
Output is correct |
21 |
Correct |
3 ms |
652 KB |
Output is correct |
22 |
Correct |
2 ms |
652 KB |
Output is correct |
23 |
Correct |
2 ms |
652 KB |
Output is correct |
24 |
Correct |
3 ms |
652 KB |
Output is correct |
25 |
Correct |
2 ms |
652 KB |
Output is correct |
26 |
Correct |
2 ms |
652 KB |
Output is correct |
27 |
Incorrect |
3 ms |
652 KB |
Output isn't correct |
28 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
652 KB |
Output is correct |
2 |
Correct |
2 ms |
652 KB |
Output is correct |
3 |
Correct |
2 ms |
652 KB |
Output is correct |
4 |
Correct |
2 ms |
652 KB |
Output is correct |
5 |
Correct |
2 ms |
652 KB |
Output is correct |
6 |
Correct |
2 ms |
652 KB |
Output is correct |
7 |
Correct |
3 ms |
652 KB |
Output is correct |
8 |
Correct |
3 ms |
652 KB |
Output is correct |
9 |
Correct |
3 ms |
652 KB |
Output is correct |
10 |
Correct |
2 ms |
652 KB |
Output is correct |
11 |
Correct |
3 ms |
652 KB |
Output is correct |
12 |
Correct |
2 ms |
652 KB |
Output is correct |
13 |
Correct |
2 ms |
652 KB |
Output is correct |
14 |
Correct |
2 ms |
652 KB |
Output is correct |
15 |
Correct |
2 ms |
652 KB |
Output is correct |
16 |
Correct |
2 ms |
652 KB |
Output is correct |
17 |
Correct |
2 ms |
652 KB |
Output is correct |
18 |
Incorrect |
2 ms |
652 KB |
Output isn't correct |
19 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
652 KB |
Output is correct |
2 |
Correct |
5 ms |
652 KB |
Output is correct |
3 |
Correct |
27 ms |
1044 KB |
Output is correct |
4 |
Correct |
19 ms |
1044 KB |
Output is correct |
5 |
Runtime error |
10 ms |
1044 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
6 |
Halted |
0 ms |
0 KB |
- |