# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
29511 |
2017-07-19T14:40:29 Z |
inqr |
Rice Hub (IOI11_ricehub) |
C++14 |
|
43 ms |
6708 KB |
#include "ricehub.h"
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define rt insert
#define st first
#define nd second
using namespace std;
vector < long long > presum(100005);
int fienum,ans;
long long b;
long long sum(int l,int r){
if(l==0)return presum[r];
else return presum[r]-presum[l-1];
}
long long comp(int l,int r,int X[]){
long long m=(l+r)/2;
long long lc=m-l,rc=r-m;
return lc*X[m]-sum(l,m-1)+sum(m+1,r)-rc*X[m];
}
void solve(int s,int X[]){
int l=s,r=fienum-1;
while(l<=r){
int m=(l+r)/2;
//printf("s=%d l=%d r=%d m=%d comp=%d %d\n",s,l,r,m,comp(s,m,X).st,comp(s,m,X).nd);
if(comp(s,m,X)<=b){
l=m+1;
ans=max(ans,m-s+1);
}
else r=m-1;
}
}
int besthub(int R, int L, int X[], long long B)
{
fienum=R;b=B;
presum[0]=X[0];
for(int i=1;i<R;i++)presum[i]=presum[i-1]+X[i];
for(int i=0;i<R;i++){
solve(i,X);
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
6708 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
6708 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
6708 KB |
Output is correct |
2 |
Correct |
0 ms |
6708 KB |
Output is correct |
3 |
Correct |
0 ms |
6708 KB |
Output is correct |
4 |
Correct |
0 ms |
6708 KB |
Output is correct |
5 |
Correct |
0 ms |
6708 KB |
Output is correct |
6 |
Correct |
0 ms |
6708 KB |
Output is correct |
7 |
Correct |
0 ms |
6708 KB |
Output is correct |
8 |
Correct |
0 ms |
6708 KB |
Output is correct |
9 |
Correct |
0 ms |
6708 KB |
Output is correct |
10 |
Correct |
0 ms |
6708 KB |
Output is correct |
11 |
Correct |
0 ms |
6708 KB |
Output is correct |
12 |
Correct |
0 ms |
6708 KB |
Output is correct |
13 |
Correct |
0 ms |
6708 KB |
Output is correct |
14 |
Correct |
0 ms |
6708 KB |
Output is correct |
15 |
Correct |
0 ms |
6708 KB |
Output is correct |
16 |
Correct |
0 ms |
6708 KB |
Output is correct |
17 |
Correct |
0 ms |
6708 KB |
Output is correct |
18 |
Correct |
0 ms |
6708 KB |
Output is correct |
19 |
Correct |
0 ms |
6708 KB |
Output is correct |
20 |
Correct |
0 ms |
6708 KB |
Output is correct |
21 |
Correct |
0 ms |
6708 KB |
Output is correct |
22 |
Correct |
0 ms |
6708 KB |
Output is correct |
23 |
Correct |
0 ms |
6708 KB |
Output is correct |
24 |
Correct |
0 ms |
6708 KB |
Output is correct |
25 |
Correct |
0 ms |
6708 KB |
Output is correct |
26 |
Correct |
3 ms |
6708 KB |
Output is correct |
27 |
Correct |
3 ms |
6708 KB |
Output is correct |
28 |
Correct |
0 ms |
6708 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
6708 KB |
Output is correct |
2 |
Correct |
3 ms |
6708 KB |
Output is correct |
3 |
Correct |
29 ms |
6708 KB |
Output is correct |
4 |
Correct |
43 ms |
6708 KB |
Output is correct |
5 |
Correct |
13 ms |
6708 KB |
Output is correct |
6 |
Correct |
13 ms |
6708 KB |
Output is correct |
7 |
Correct |
26 ms |
6708 KB |
Output is correct |
8 |
Correct |
26 ms |
6708 KB |
Output is correct |
9 |
Correct |
9 ms |
6708 KB |
Output is correct |
10 |
Correct |
13 ms |
6708 KB |
Output is correct |
11 |
Correct |
26 ms |
6708 KB |
Output is correct |
12 |
Correct |
29 ms |
6708 KB |
Output is correct |
13 |
Correct |
16 ms |
6708 KB |
Output is correct |
14 |
Correct |
16 ms |
6708 KB |
Output is correct |
15 |
Correct |
29 ms |
6708 KB |
Output is correct |
16 |
Correct |
23 ms |
6708 KB |
Output is correct |
17 |
Correct |
39 ms |
6708 KB |
Output is correct |
18 |
Correct |
26 ms |
6708 KB |
Output is correct |
19 |
Correct |
33 ms |
6708 KB |
Output is correct |
20 |
Correct |
39 ms |
6708 KB |
Output is correct |