# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
563335 |
2022-05-17T00:13:10 Z |
1ne |
Rice Hub (IOI11_ricehub) |
C++14 |
|
1000 ms |
3744 KB |
#include "ricehub.h"
#include<bits/stdc++.h>
using namespace std;
int besthub(int R, int L, int X[], long long B)
{
int ans = 0;
vector<int64_t>pref(R + 1,0),dpref(R + 1,0);
vector<int64_t>suff(R + 1,0),dsuff(R + 1,0);
for (int i = 0 ;i<R - 1;++i){
pref[i + 1] = pref[i] + (X[i + 1] - X[i]);
dpref[i + 2] = pref[i + 1] + dpref[i + 1];
}
for (int i = R - 2 ;i>=0;--i){
suff[i] = suff[i + 1] + (X[i + 1] - X[i]);
dsuff[i] = suff[i] + dsuff[i + 1];
}
auto dist = [&](int l,int r){
return pref[r] * (r - l) - dpref[r] + dpref[l];
};
auto dist2 = [&](int l,int r){
return suff[l] * (r - l) + dsuff[r + 1] - dsuff[l + 1];
};
auto distt = [&](int l,int r){
int mid = (l + r)>>1;
//cout<<dist(l,mid)<< " "<<dist(mid,r)<<" ";
return dist(l,mid) + dist2(mid,r);
};
for (int i = 0;i<R;++i){
int j = i + 1;
while(j<R){
if (distt(i,j)<=B){
ans = max(ans,j - i + 1);
++j;
}
else{
break;
}
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
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 |
2 ms |
212 KB |
Output is correct |
4 |
Correct |
2 ms |
340 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 |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
312 KB |
Output is correct |
11 |
Correct |
1 ms |
316 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
2 ms |
340 KB |
Output is correct |
14 |
Correct |
2 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
2 ms |
312 KB |
Output is correct |
18 |
Correct |
2 ms |
340 KB |
Output is correct |
19 |
Correct |
2 ms |
340 KB |
Output is correct |
20 |
Correct |
2 ms |
340 KB |
Output is correct |
21 |
Correct |
4 ms |
512 KB |
Output is correct |
22 |
Correct |
4 ms |
448 KB |
Output is correct |
23 |
Correct |
33 ms |
468 KB |
Output is correct |
24 |
Correct |
33 ms |
468 KB |
Output is correct |
25 |
Correct |
33 ms |
500 KB |
Output is correct |
26 |
Correct |
33 ms |
504 KB |
Output is correct |
27 |
Correct |
25 ms |
468 KB |
Output is correct |
28 |
Correct |
25 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
1040 KB |
Output is correct |
2 |
Correct |
7 ms |
980 KB |
Output is correct |
3 |
Execution timed out |
1085 ms |
3744 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |