# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
61154 |
2018-07-25T09:09:49 Z |
Vahan |
Rice Hub (IOI11_ricehub) |
C++17 |
|
36 ms |
2684 KB |
#include "ricehub.h"
#include<algorithm>
#include<iostream>
using namespace std;
long long x[200000];
long long su[200000];
long long pat(long long l,long long r)
{
long long mid=(l+r)/2;
return (mid-l+1)*x[mid]+su[l]-x[l]+su[r]-(r-mid)*x[mid]-2*su[mid];
}
int besthub(int R, int L, int X[], long long B)
{
for(int r=0;r<R;r++)
{
x[r]=X[r];
if(r==0)
su[r]=x[r];
else
su[r]=su[r-1]+x[r];
}
int l=0;
int an=-1;
long long q;
for(int r=0;r<R;r++)
{
q=pat(l,r);
while(q>B)
{
l++;
q=pat(l,r);
}
q=pat(l,r);
an=max(an,r-l+1);
}
return an;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
412 KB |
Output is correct |
4 |
Correct |
3 ms |
412 KB |
Output is correct |
5 |
Correct |
2 ms |
444 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
560 KB |
Output is correct |
2 |
Correct |
3 ms |
560 KB |
Output is correct |
3 |
Correct |
2 ms |
560 KB |
Output is correct |
4 |
Correct |
3 ms |
560 KB |
Output is correct |
5 |
Correct |
3 ms |
620 KB |
Output is correct |
6 |
Correct |
2 ms |
620 KB |
Output is correct |
7 |
Correct |
3 ms |
620 KB |
Output is correct |
8 |
Correct |
2 ms |
620 KB |
Output is correct |
9 |
Correct |
4 ms |
620 KB |
Output is correct |
10 |
Correct |
3 ms |
620 KB |
Output is correct |
11 |
Correct |
3 ms |
736 KB |
Output is correct |
12 |
Correct |
3 ms |
736 KB |
Output is correct |
13 |
Correct |
2 ms |
736 KB |
Output is correct |
14 |
Correct |
3 ms |
736 KB |
Output is correct |
15 |
Correct |
2 ms |
736 KB |
Output is correct |
16 |
Correct |
3 ms |
736 KB |
Output is correct |
17 |
Correct |
5 ms |
736 KB |
Output is correct |
18 |
Correct |
2 ms |
736 KB |
Output is correct |
19 |
Correct |
2 ms |
736 KB |
Output is correct |
20 |
Correct |
3 ms |
736 KB |
Output is correct |
21 |
Correct |
3 ms |
736 KB |
Output is correct |
22 |
Correct |
3 ms |
736 KB |
Output is correct |
23 |
Correct |
3 ms |
736 KB |
Output is correct |
24 |
Correct |
2 ms |
736 KB |
Output is correct |
25 |
Correct |
3 ms |
748 KB |
Output is correct |
26 |
Correct |
2 ms |
748 KB |
Output is correct |
27 |
Correct |
3 ms |
748 KB |
Output is correct |
28 |
Correct |
2 ms |
748 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
748 KB |
Output is correct |
2 |
Correct |
2 ms |
748 KB |
Output is correct |
3 |
Correct |
3 ms |
748 KB |
Output is correct |
4 |
Correct |
3 ms |
748 KB |
Output is correct |
5 |
Correct |
2 ms |
748 KB |
Output is correct |
6 |
Correct |
3 ms |
748 KB |
Output is correct |
7 |
Correct |
3 ms |
748 KB |
Output is correct |
8 |
Correct |
3 ms |
748 KB |
Output is correct |
9 |
Correct |
3 ms |
748 KB |
Output is correct |
10 |
Correct |
3 ms |
748 KB |
Output is correct |
11 |
Correct |
4 ms |
748 KB |
Output is correct |
12 |
Correct |
3 ms |
748 KB |
Output is correct |
13 |
Correct |
3 ms |
748 KB |
Output is correct |
14 |
Correct |
3 ms |
748 KB |
Output is correct |
15 |
Correct |
4 ms |
748 KB |
Output is correct |
16 |
Correct |
3 ms |
748 KB |
Output is correct |
17 |
Correct |
3 ms |
748 KB |
Output is correct |
18 |
Correct |
3 ms |
748 KB |
Output is correct |
19 |
Correct |
3 ms |
748 KB |
Output is correct |
20 |
Correct |
3 ms |
748 KB |
Output is correct |
21 |
Correct |
3 ms |
748 KB |
Output is correct |
22 |
Correct |
3 ms |
748 KB |
Output is correct |
23 |
Correct |
3 ms |
748 KB |
Output is correct |
24 |
Correct |
3 ms |
748 KB |
Output is correct |
25 |
Correct |
5 ms |
748 KB |
Output is correct |
26 |
Correct |
4 ms |
748 KB |
Output is correct |
27 |
Correct |
4 ms |
748 KB |
Output is correct |
28 |
Correct |
5 ms |
748 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
1020 KB |
Output is correct |
2 |
Correct |
8 ms |
1020 KB |
Output is correct |
3 |
Correct |
26 ms |
2560 KB |
Output is correct |
4 |
Correct |
29 ms |
2644 KB |
Output is correct |
5 |
Correct |
12 ms |
2644 KB |
Output is correct |
6 |
Correct |
10 ms |
2644 KB |
Output is correct |
7 |
Correct |
20 ms |
2684 KB |
Output is correct |
8 |
Correct |
20 ms |
2684 KB |
Output is correct |
9 |
Correct |
10 ms |
2684 KB |
Output is correct |
10 |
Correct |
10 ms |
2684 KB |
Output is correct |
11 |
Correct |
24 ms |
2684 KB |
Output is correct |
12 |
Correct |
24 ms |
2684 KB |
Output is correct |
13 |
Correct |
12 ms |
2684 KB |
Output is correct |
14 |
Correct |
12 ms |
2684 KB |
Output is correct |
15 |
Correct |
19 ms |
2684 KB |
Output is correct |
16 |
Correct |
20 ms |
2684 KB |
Output is correct |
17 |
Correct |
22 ms |
2684 KB |
Output is correct |
18 |
Correct |
26 ms |
2684 KB |
Output is correct |
19 |
Correct |
33 ms |
2684 KB |
Output is correct |
20 |
Correct |
36 ms |
2684 KB |
Output is correct |