# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
36277 |
2017-12-07T03:59:32 Z |
funcsr |
Rice Hub (IOI11_ricehub) |
C++14 |
|
43 ms |
7092 KB |
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include "ricehub.h"
using namespace std;
#define INF 1145141919
#define rep(i, n) for (int i=0; i<(n); i++)
#define _1 first
#define _2 second
#define all(x) x.begin(), x.end()
#define pb push_back
typedef pair<int, int> P;
int N, L;
long long B;
int X[100000];
long long T[100001];
inline long long sum(int l, int r) {
return T[r+1] - T[l];
}
inline long long f(int l, int r) {
int g = (l+r)/2;
// (1LL*(g-l+1)*X[g] - sum(l, g)) + (sum(g, r) - 1LL*(r-g+1)*X[g]);
return 1LL*(2*g-l-r)*X[g] + sum(g, r) - sum(l, g);
}
int besthub(int n, int l, int x[], long long b) {
N = n, L = l, B = b;
rep(i, N) X[i] = x[i];
T[0] = 0;
rep(i, N) T[i+1] = T[i] + X[i];
int m = 0;
rep(l, N) {
int lo = l, hi = N;
while (hi - lo > 1) {
int mid = (lo + hi) / 2;
if (f(l, mid) <= B) lo = mid;
else hi = mid;
}
m = max(m, lo-l+1);
}
return m;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
7092 KB |
Output is correct |
2 |
Correct |
0 ms |
7092 KB |
Output is correct |
3 |
Correct |
0 ms |
7092 KB |
Output is correct |
4 |
Correct |
0 ms |
7092 KB |
Output is correct |
5 |
Correct |
0 ms |
7092 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
7092 KB |
Output is correct |
2 |
Correct |
0 ms |
7092 KB |
Output is correct |
3 |
Correct |
0 ms |
7092 KB |
Output is correct |
4 |
Correct |
0 ms |
7092 KB |
Output is correct |
5 |
Correct |
0 ms |
7092 KB |
Output is correct |
6 |
Correct |
0 ms |
7092 KB |
Output is correct |
7 |
Correct |
0 ms |
7092 KB |
Output is correct |
8 |
Correct |
0 ms |
7092 KB |
Output is correct |
9 |
Correct |
0 ms |
7092 KB |
Output is correct |
10 |
Correct |
0 ms |
7092 KB |
Output is correct |
11 |
Correct |
0 ms |
7092 KB |
Output is correct |
12 |
Correct |
0 ms |
7092 KB |
Output is correct |
13 |
Correct |
0 ms |
7092 KB |
Output is correct |
14 |
Correct |
0 ms |
7092 KB |
Output is correct |
15 |
Correct |
0 ms |
7092 KB |
Output is correct |
16 |
Correct |
0 ms |
7092 KB |
Output is correct |
17 |
Correct |
0 ms |
7092 KB |
Output is correct |
18 |
Correct |
0 ms |
7092 KB |
Output is correct |
19 |
Correct |
0 ms |
7092 KB |
Output is correct |
20 |
Correct |
0 ms |
7092 KB |
Output is correct |
21 |
Correct |
0 ms |
7092 KB |
Output is correct |
22 |
Correct |
0 ms |
7092 KB |
Output is correct |
23 |
Correct |
0 ms |
7092 KB |
Output is correct |
24 |
Correct |
0 ms |
7092 KB |
Output is correct |
25 |
Correct |
0 ms |
7092 KB |
Output is correct |
26 |
Correct |
0 ms |
7092 KB |
Output is correct |
27 |
Correct |
0 ms |
7092 KB |
Output is correct |
28 |
Correct |
0 ms |
7092 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
7092 KB |
Output is correct |
2 |
Correct |
0 ms |
7092 KB |
Output is correct |
3 |
Correct |
0 ms |
7092 KB |
Output is correct |
4 |
Correct |
0 ms |
7092 KB |
Output is correct |
5 |
Correct |
0 ms |
7092 KB |
Output is correct |
6 |
Correct |
0 ms |
7092 KB |
Output is correct |
7 |
Correct |
0 ms |
7092 KB |
Output is correct |
8 |
Correct |
0 ms |
7092 KB |
Output is correct |
9 |
Correct |
0 ms |
7092 KB |
Output is correct |
10 |
Correct |
0 ms |
7092 KB |
Output is correct |
11 |
Correct |
0 ms |
7092 KB |
Output is correct |
12 |
Correct |
0 ms |
7092 KB |
Output is correct |
13 |
Correct |
0 ms |
7092 KB |
Output is correct |
14 |
Correct |
0 ms |
7092 KB |
Output is correct |
15 |
Correct |
0 ms |
7092 KB |
Output is correct |
16 |
Correct |
0 ms |
7092 KB |
Output is correct |
17 |
Correct |
0 ms |
7092 KB |
Output is correct |
18 |
Correct |
0 ms |
7092 KB |
Output is correct |
19 |
Correct |
0 ms |
7092 KB |
Output is correct |
20 |
Correct |
0 ms |
7092 KB |
Output is correct |
21 |
Correct |
0 ms |
7092 KB |
Output is correct |
22 |
Correct |
0 ms |
7092 KB |
Output is correct |
23 |
Correct |
0 ms |
7092 KB |
Output is correct |
24 |
Correct |
0 ms |
7092 KB |
Output is correct |
25 |
Correct |
0 ms |
7092 KB |
Output is correct |
26 |
Correct |
0 ms |
7092 KB |
Output is correct |
27 |
Correct |
0 ms |
7092 KB |
Output is correct |
28 |
Correct |
0 ms |
7092 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
7092 KB |
Output is correct |
2 |
Correct |
6 ms |
7092 KB |
Output is correct |
3 |
Correct |
26 ms |
7092 KB |
Output is correct |
4 |
Correct |
36 ms |
7092 KB |
Output is correct |
5 |
Correct |
13 ms |
7092 KB |
Output is correct |
6 |
Correct |
13 ms |
7092 KB |
Output is correct |
7 |
Correct |
39 ms |
7092 KB |
Output is correct |
8 |
Correct |
29 ms |
7092 KB |
Output is correct |
9 |
Correct |
13 ms |
7092 KB |
Output is correct |
10 |
Correct |
13 ms |
7092 KB |
Output is correct |
11 |
Correct |
43 ms |
7092 KB |
Output is correct |
12 |
Correct |
29 ms |
7092 KB |
Output is correct |
13 |
Correct |
16 ms |
7092 KB |
Output is correct |
14 |
Correct |
19 ms |
7092 KB |
Output is correct |
15 |
Correct |
26 ms |
7092 KB |
Output is correct |
16 |
Correct |
19 ms |
7092 KB |
Output is correct |
17 |
Correct |
29 ms |
7092 KB |
Output is correct |
18 |
Correct |
33 ms |
7092 KB |
Output is correct |
19 |
Correct |
33 ms |
7092 KB |
Output is correct |
20 |
Correct |
26 ms |
7092 KB |
Output is correct |