# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
233125 | 2020-05-19T12:03:54 Z | crossing0ver | Rice Hub (IOI11_ricehub) | C++17 | 22 ms | 2432 KB |
#include<bits/stdc++.h> #include "ricehub.h" using namespace std; int besthub(int n, int L, int X[], long long B){ long long sum = 0,tot = 0; int num = 0; int last = 0; vector<long long> PR(n); int ans = 0,ps = 0; for (int i = 0 ; i < n; i++) { sum += X[i]; tot += X[i]; PR[i] = sum; num++; while (true) { long long e = tot/num; int pos = (last + i + 1)/2; long long D = 0; long long s = 1ll*X[pos]*(pos - last + 1) - (PR[pos] - (last ? PR[last-1] : 0)) + (PR[i] - PR[pos]) -1ll*X[pos]*( i - pos); if (s <= B) if (ans < i - last + 1) ans = i - last + 1, ps = X[pos]; if (pos > last) pos--; D = s; /* pos = upper_bound(X + last, X + i+1, e) - X - 1; if (pos <= i && pos >= last) { s =X[pos]*(pos - last + 1) - (PR[pos] - (last ? PR[last-1] : 0)) + (PR[i] - PR[pos]) -X[pos]*( i - pos); D = min(D,s); if (s <= B) if (ans < i - last + 1) ans = i - last + 1, ps = X[pos]; } */ if (D > B) { tot-=X[last]; last++; num--; continue; } else break; } } return ans; } /* main() { int n,L; long long B; cin >> n >> L >> B; int X[n]; for (int i = 0; i < n ; i++) cin >> X[i]; cout << besthub(n,L,X,B); } */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 256 KB | Output is correct |
2 | Correct | 4 ms | 384 KB | Output is correct |
3 | Correct | 4 ms | 256 KB | Output is correct |
4 | Correct | 5 ms | 256 KB | Output is correct |
5 | Correct | 4 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 256 KB | Output is correct |
2 | Correct | 5 ms | 432 KB | Output is correct |
3 | Correct | 4 ms | 256 KB | Output is correct |
4 | Correct | 4 ms | 256 KB | Output is correct |
5 | Correct | 4 ms | 256 KB | Output is correct |
6 | Correct | 4 ms | 256 KB | Output is correct |
7 | Correct | 4 ms | 256 KB | Output is correct |
8 | Correct | 4 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 256 KB | Output is correct |
10 | Correct | 4 ms | 256 KB | Output is correct |
11 | Correct | 4 ms | 256 KB | Output is correct |
12 | Correct | 4 ms | 256 KB | Output is correct |
13 | Correct | 5 ms | 256 KB | Output is correct |
14 | Correct | 5 ms | 384 KB | Output is correct |
15 | Correct | 5 ms | 256 KB | Output is correct |
16 | Correct | 5 ms | 256 KB | Output is correct |
17 | Correct | 5 ms | 256 KB | Output is correct |
18 | Correct | 5 ms | 384 KB | Output is correct |
19 | Correct | 5 ms | 256 KB | Output is correct |
20 | Correct | 4 ms | 256 KB | Output is correct |
21 | Correct | 5 ms | 384 KB | Output is correct |
22 | Correct | 5 ms | 384 KB | Output is correct |
23 | Correct | 5 ms | 256 KB | Output is correct |
24 | Correct | 4 ms | 256 KB | Output is correct |
25 | Correct | 5 ms | 256 KB | Output is correct |
26 | Correct | 4 ms | 384 KB | Output is correct |
27 | Correct | 5 ms | 256 KB | Output is correct |
28 | Correct | 5 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 256 KB | Output is correct |
2 | Correct | 5 ms | 256 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 256 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 4 ms | 256 KB | Output is correct |
10 | Correct | 4 ms | 256 KB | Output is correct |
11 | Correct | 5 ms | 384 KB | Output is correct |
12 | Correct | 5 ms | 384 KB | Output is correct |
13 | Correct | 5 ms | 384 KB | Output is correct |
14 | Correct | 4 ms | 384 KB | Output is correct |
15 | Correct | 5 ms | 256 KB | Output is correct |
16 | Correct | 5 ms | 384 KB | Output is correct |
17 | Correct | 5 ms | 384 KB | Output is correct |
18 | Correct | 5 ms | 256 KB | Output is correct |
19 | Correct | 5 ms | 384 KB | Output is correct |
20 | Correct | 5 ms | 384 KB | Output is correct |
21 | Correct | 5 ms | 384 KB | Output is correct |
22 | Correct | 5 ms | 384 KB | Output is correct |
23 | Correct | 6 ms | 384 KB | Output is correct |
24 | Correct | 5 ms | 384 KB | Output is correct |
25 | Correct | 5 ms | 384 KB | Output is correct |
26 | Correct | 5 ms | 384 KB | Output is correct |
27 | Correct | 6 ms | 384 KB | Output is correct |
28 | Correct | 5 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 512 KB | Output is correct |
2 | Correct | 7 ms | 640 KB | Output is correct |
3 | Correct | 22 ms | 1536 KB | Output is correct |
4 | Correct | 19 ms | 1536 KB | Output is correct |
5 | Correct | 10 ms | 896 KB | Output is correct |
6 | Correct | 11 ms | 896 KB | Output is correct |
7 | Correct | 17 ms | 1536 KB | Output is correct |
8 | Correct | 17 ms | 1536 KB | Output is correct |
9 | Correct | 11 ms | 896 KB | Output is correct |
10 | Correct | 10 ms | 896 KB | Output is correct |
11 | Correct | 22 ms | 1536 KB | Output is correct |
12 | Correct | 21 ms | 1536 KB | Output is correct |
13 | Correct | 12 ms | 1280 KB | Output is correct |
14 | Correct | 12 ms | 1280 KB | Output is correct |
15 | Correct | 18 ms | 1920 KB | Output is correct |
16 | Correct | 17 ms | 1920 KB | Output is correct |
17 | Correct | 20 ms | 2304 KB | Output is correct |
18 | Correct | 20 ms | 2304 KB | Output is correct |
19 | Correct | 21 ms | 2432 KB | Output is correct |
20 | Correct | 21 ms | 2432 KB | Output is correct |