#include "ricehub.h"
#include<bits/stdc++.h>
using namespace std;
long long int typedef li;
int besthub(int n, int m, int x[], li b)
{
int mx=0,l=0,r=0; li t=0;
for (int i=0;i<n;i++) if (t+(x[i]-x[0])<=b) t+=(x[i]-x[0]),r++;
for (int i=1;i<n;i++)
{
t+=(2*i-l-r)*(x[i]-x[i-1]);
while (t>b) t-=(x[i]-x[l]),l++;
while (r<n && t+(x[r]-x[i])<=b) t+=(x[r]-x[i]),r++;
mx=max(mx,r-l);
}
return mx;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
280 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
240 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
0 ms |
212 KB |
Output is correct |
15 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
340 KB |
Output is correct |
2 |
Correct |
3 ms |
320 KB |
Output is correct |
3 |
Correct |
15 ms |
696 KB |
Output is correct |
4 |
Correct |
12 ms |
596 KB |
Output is correct |
5 |
Correct |
4 ms |
468 KB |
Output is correct |
6 |
Correct |
5 ms |
508 KB |
Output is correct |
7 |
Correct |
9 ms |
700 KB |
Output is correct |
8 |
Correct |
11 ms |
700 KB |
Output is correct |
9 |
Correct |
5 ms |
516 KB |
Output is correct |
10 |
Correct |
4 ms |
524 KB |
Output is correct |
11 |
Correct |
11 ms |
636 KB |
Output is correct |
12 |
Runtime error |
12 ms |
1236 KB |
Execution killed with signal 11 |
13 |
Halted |
0 ms |
0 KB |
- |