# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
799540 |
2023-07-31T15:44:43 Z |
Liudas |
Rice Hub (IOI11_ricehub) |
C++17 |
|
1000 ms |
2444 KB |
#include <bits/stdc++.h>
#include "ricehub.h"
using namespace std;
int besthub(int N, int L, int arr[], long long B){
vector<int> brr;
for(int i = 0; i < N; i ++){
brr.push_back(arr[i]);
}
int l = 0, r = N + 1;
while(l + 1 < r){
int mid = (l + r + 1) / 2;
int best = 0;
for(int i = 0; i < N - mid + 1; i ++){
int t = arr[i + mid / 2], s = 0;
long long T = B;
//cout <<"start " << t << " " << T << " " << endl;
for(int j = i; j < i + mid; j ++){
//cout <<j <<" " << arr[j] << endl;
if(T < abs(t - arr[j]))break;
s++;
T -= abs(t - arr[j]);
}
best = max(best, s);
}
//cout <<"ans " << best << " " << mid << endl;
if(best == mid){
l = mid;
}
else{
r = mid;
}
}
return l;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 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 |
# |
Verdict |
Execution time |
Memory |
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 |
0 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 |
0 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 |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
0 ms |
212 KB |
Output is correct |
15 |
Correct |
0 ms |
212 KB |
Output is correct |
16 |
Correct |
0 ms |
212 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
0 ms |
212 KB |
Output is correct |
20 |
Correct |
0 ms |
212 KB |
Output is correct |
21 |
Correct |
1 ms |
212 KB |
Output is correct |
22 |
Correct |
1 ms |
212 KB |
Output is correct |
23 |
Correct |
1 ms |
212 KB |
Output is correct |
24 |
Correct |
1 ms |
212 KB |
Output is correct |
25 |
Correct |
1 ms |
212 KB |
Output is correct |
26 |
Correct |
1 ms |
212 KB |
Output is correct |
27 |
Correct |
1 ms |
212 KB |
Output is correct |
28 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
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 |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 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 |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
316 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Correct |
10 ms |
404 KB |
Output is correct |
22 |
Correct |
10 ms |
412 KB |
Output is correct |
23 |
Correct |
17 ms |
412 KB |
Output is correct |
24 |
Correct |
17 ms |
420 KB |
Output is correct |
25 |
Correct |
17 ms |
420 KB |
Output is correct |
26 |
Correct |
17 ms |
340 KB |
Output is correct |
27 |
Correct |
50 ms |
316 KB |
Output is correct |
28 |
Correct |
41 ms |
408 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
596 KB |
Output is correct |
2 |
Correct |
14 ms |
724 KB |
Output is correct |
3 |
Execution timed out |
1084 ms |
2444 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |