Submission #714054

# Submission time Handle Problem Language Result Execution time Memory
714054 2023-03-23T17:55:20 Z Spade1 Rice Hub (IOI11_ricehub) C++14
100 / 100
13 ms 2304 KB
#include <bits/stdc++.h>
#define ll long long
#include "ricehub.h"
//#include "grader.cpp"

using namespace std;

ll x[100010], qs[100010];

int besthub(int R, int L, int _X[], ll B) {
    for (int i = 1; i <= R; ++i) x[i] = _X[i-1];
    for (int i = 1; i <= R; ++i) qs[i] = qs[i-1] + x[i];

    ll l = 1, r = R;
    while (l < r) {
        ll mid = (l+r+1)/2;
        bool y = 0;
        for (ll i = 1, j = mid; j <= R; ++i, ++j) {
            ll md = (i+j)/2;
            if (qs[j]-qs[md]-(j-md)*x[md] + (md-i)*x[md]-qs[md-1]+qs[i-1] <= B) y = 1;
        }
        if (y) l = mid;
        else r = mid-1;
    }
    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 1 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 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 308 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 304 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 308 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 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 308 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 1 ms 212 KB Output is correct
22 Correct 0 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 304 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 1 ms 212 KB Output is correct
2 Correct 1 ms 308 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 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 308 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 308 KB Output is correct
12 Correct 1 ms 308 KB Output is correct
13 Correct 1 ms 304 KB Output is correct
14 Correct 1 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 1 ms 212 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 2 ms 444 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 452 KB Output is correct
26 Correct 2 ms 448 KB Output is correct
27 Correct 1 ms 444 KB Output is correct
28 Correct 1 ms 452 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 724 KB Output is correct
2 Correct 3 ms 708 KB Output is correct
3 Correct 12 ms 2304 KB Output is correct
4 Correct 13 ms 2260 KB Output is correct
5 Correct 7 ms 1344 KB Output is correct
6 Correct 6 ms 1364 KB Output is correct
7 Correct 11 ms 2244 KB Output is correct
8 Correct 12 ms 2260 KB Output is correct
9 Correct 7 ms 1372 KB Output is correct
10 Correct 6 ms 1340 KB Output is correct
11 Correct 12 ms 2260 KB Output is correct
12 Correct 12 ms 2260 KB Output is correct
13 Correct 6 ms 1364 KB Output is correct
14 Correct 8 ms 1364 KB Output is correct
15 Correct 10 ms 1816 KB Output is correct
16 Correct 9 ms 1868 KB Output is correct
17 Correct 12 ms 2116 KB Output is correct
18 Correct 11 ms 2056 KB Output is correct
19 Correct 12 ms 2260 KB Output is correct
20 Correct 12 ms 2236 KB Output is correct