Submission #730708

# Submission time Handle Problem Language Result Execution time Memory
730708 2023-04-26T10:05:35 Z lucri Rice Hub (IOI11_ricehub) C++17
100 / 100
15 ms 2480 KB
#include "ricehub.h"
#include <stdio.h>
#include <stdlib.h>
long long sum[100010];
int besthub(int R, int L, int X[], long long B)
{
    for(int i=0;i<R;++i)
        sum[i+1]=sum[i]+X[i];
    int b=0,e=R;
    while(b<=e)
    {
        int mid=(b+e)/2;
        bool ok=false;
        for(int i=0;i+mid-1<R;++i)
        {
            long long suma=1LL*X[(i+i+mid-1)/2]*((i+i+mid-1)/2-i)-(sum[(i+i+mid-1)/2]-sum[i]);
            suma+=(sum[i+mid]-sum[(i+i+mid-1)/2+1])-1LL*X[(i+i+mid-1)/2]*(i+mid-1-(i+i+mid-1)/2);
            if(B>=suma)
                ok=true;
        }
        if(ok==true)
            b=mid+1;
        else
            e=mid-1;
    }
    return e;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 300 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 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 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 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 212 KB Output is correct
11 Correct 1 ms 296 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 296 KB Output is correct
14 Correct 0 ms 292 KB Output is correct
15 Correct 0 ms 292 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 292 KB Output is correct
19 Correct 0 ms 288 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 288 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 288 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 1 ms 288 KB Output is correct
28 Correct 0 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 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 292 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 292 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 288 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 300 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 1 ms 328 KB Output is correct
22 Correct 2 ms 328 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 304 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 300 KB Output is correct
28 Correct 1 ms 424 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 620 KB Output is correct
2 Correct 3 ms 616 KB Output is correct
3 Correct 14 ms 2476 KB Output is correct
4 Correct 14 ms 2480 KB Output is correct
5 Correct 8 ms 1204 KB Output is correct
6 Correct 9 ms 1108 KB Output is correct
7 Correct 12 ms 2132 KB Output is correct
8 Correct 13 ms 2132 KB Output is correct
9 Correct 7 ms 1060 KB Output is correct
10 Correct 8 ms 1052 KB Output is correct
11 Correct 15 ms 2412 KB Output is correct
12 Correct 15 ms 2436 KB Output is correct
13 Correct 9 ms 1236 KB Output is correct
14 Correct 8 ms 1200 KB Output is correct
15 Correct 11 ms 1876 KB Output is correct
16 Correct 11 ms 1876 KB Output is correct
17 Correct 13 ms 2168 KB Output is correct
18 Correct 13 ms 2252 KB Output is correct
19 Correct 14 ms 2356 KB Output is correct
20 Correct 14 ms 2308 KB Output is correct