# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
113697 |
2019-05-27T21:58:03 Z |
degelo |
Rice Hub (IOI11_ricehub) |
C++17 |
|
16 ms |
1792 KB |
#include<bits/stdc++.h>
#include "ricehub.h"
using namespace std;
int besthub(int r,int l,int x[],long long int b){
int M=0;
int ini=0,fim=0;
long long int soma=0;
while(fim<r){
if(soma<=b){
M=max(M,fim-ini+1);
int med=(fim+ini+1)/2;
fim++;
soma+=(x[fim]-x[med]);
//cout<<ini<<ends<<fim<<ends<<soma<<endl;
}
else{
int med=(fim+ini+1)/2;
soma-=(x[med]-x[ini]);
ini++;
//cout<<ini<<ends<<fim<<ends<<soma<<endl;
}
}
return M;
}
/*int main(){
int r,l,b;
int x[100000];
scanf("%d %d %d",&r,&l,&b);
for(int i=0;i<r;i++){
scanf("%d",&x[i]);
}
printf("%d",besthub(r,l,x,b));
}*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
2 ms |
384 KB |
Output is correct |
8 |
Correct |
2 ms |
384 KB |
Output is correct |
9 |
Correct |
2 ms |
384 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
2 ms |
256 KB |
Output is correct |
12 |
Correct |
2 ms |
384 KB |
Output is correct |
13 |
Correct |
2 ms |
256 KB |
Output is correct |
14 |
Correct |
2 ms |
256 KB |
Output is correct |
15 |
Correct |
2 ms |
256 KB |
Output is correct |
16 |
Correct |
2 ms |
256 KB |
Output is correct |
17 |
Correct |
2 ms |
384 KB |
Output is correct |
18 |
Correct |
2 ms |
384 KB |
Output is correct |
19 |
Correct |
2 ms |
384 KB |
Output is correct |
20 |
Correct |
2 ms |
256 KB |
Output is correct |
21 |
Correct |
2 ms |
256 KB |
Output is correct |
22 |
Correct |
2 ms |
256 KB |
Output is correct |
23 |
Correct |
2 ms |
384 KB |
Output is correct |
24 |
Correct |
2 ms |
384 KB |
Output is correct |
25 |
Correct |
2 ms |
384 KB |
Output is correct |
26 |
Correct |
2 ms |
384 KB |
Output is correct |
27 |
Correct |
2 ms |
384 KB |
Output is correct |
28 |
Correct |
2 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
2 ms |
384 KB |
Output is correct |
8 |
Correct |
2 ms |
256 KB |
Output is correct |
9 |
Correct |
2 ms |
256 KB |
Output is correct |
10 |
Correct |
2 ms |
256 KB |
Output is correct |
11 |
Correct |
2 ms |
384 KB |
Output is correct |
12 |
Correct |
2 ms |
384 KB |
Output is correct |
13 |
Correct |
2 ms |
384 KB |
Output is correct |
14 |
Correct |
2 ms |
384 KB |
Output is correct |
15 |
Correct |
2 ms |
384 KB |
Output is correct |
16 |
Correct |
2 ms |
384 KB |
Output is correct |
17 |
Correct |
2 ms |
256 KB |
Output is correct |
18 |
Correct |
2 ms |
256 KB |
Output is correct |
19 |
Correct |
2 ms |
384 KB |
Output is correct |
20 |
Correct |
2 ms |
384 KB |
Output is correct |
21 |
Correct |
2 ms |
384 KB |
Output is correct |
22 |
Correct |
3 ms |
384 KB |
Output is correct |
23 |
Correct |
2 ms |
384 KB |
Output is correct |
24 |
Correct |
2 ms |
384 KB |
Output is correct |
25 |
Correct |
2 ms |
384 KB |
Output is correct |
26 |
Correct |
2 ms |
384 KB |
Output is correct |
27 |
Correct |
2 ms |
384 KB |
Output is correct |
28 |
Correct |
2 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
512 KB |
Output is correct |
2 |
Correct |
5 ms |
512 KB |
Output is correct |
3 |
Correct |
14 ms |
1764 KB |
Output is correct |
4 |
Correct |
15 ms |
1792 KB |
Output is correct |
5 |
Correct |
7 ms |
896 KB |
Output is correct |
6 |
Correct |
7 ms |
896 KB |
Output is correct |
7 |
Correct |
12 ms |
1408 KB |
Output is correct |
8 |
Correct |
12 ms |
1536 KB |
Output is correct |
9 |
Correct |
7 ms |
768 KB |
Output is correct |
10 |
Correct |
7 ms |
768 KB |
Output is correct |
11 |
Correct |
16 ms |
1792 KB |
Output is correct |
12 |
Correct |
16 ms |
1784 KB |
Output is correct |
13 |
Correct |
8 ms |
896 KB |
Output is correct |
14 |
Correct |
8 ms |
896 KB |
Output is correct |
15 |
Correct |
13 ms |
1340 KB |
Output is correct |
16 |
Correct |
12 ms |
1408 KB |
Output is correct |
17 |
Correct |
14 ms |
1536 KB |
Output is correct |
18 |
Correct |
15 ms |
1664 KB |
Output is correct |
19 |
Correct |
14 ms |
1664 KB |
Output is correct |
20 |
Correct |
16 ms |
1664 KB |
Output is correct |