Submission #876815

# Submission time Handle Problem Language Result Execution time Memory
876815 2023-11-22T11:28:39 Z JakobZorz Rice Hub (IOI11_ricehub) C++14
100 / 100
12 ms 4528 KB
#include "ricehub.h"
typedef long long ll;

int n;
int arr[100000];
ll ps[100001];
ll sum;

bool is_possible(int num){
    int num1=num/2;
    int num2=(num+1)/2;
    
    for(int i=num1;i<=n-num2;i++){
        if(num1*arr[i]-(ps[i]-ps[i-num1])-num2*arr[i]+(ps[i+num2]-ps[i])<=sum)
            return true;
    }
    return false;
}

int besthub(int R,int L,int X[],ll B){
    sum=B;
    n=R;
    for(int i=0;i<n;i++)
        arr[i]=X[i];
    for(int i=0;i<n;i++)
        ps[i+1]=ps[i]+arr[i];
    
    int l=1,r=100001;
    while(l<r-1){
        int m=(l+r)/2;
        if(is_possible(m))
            l=m;
        else
            r=m;
    }
    
    return l;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 0 ms 2476 KB Output is correct
3 Correct 1 ms 2392 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 1 ms 2392 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 0 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 0 ms 2396 KB Output is correct
11 Correct 0 ms 2396 KB Output is correct
12 Correct 0 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2400 KB Output is correct
18 Correct 0 ms 2476 KB Output is correct
19 Correct 0 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2400 KB Output is correct
22 Correct 0 ms 2396 KB Output is correct
23 Correct 0 ms 2400 KB Output is correct
24 Correct 1 ms 2656 KB Output is correct
25 Correct 0 ms 2400 KB Output is correct
26 Correct 0 ms 2396 KB Output is correct
27 Correct 1 ms 2648 KB Output is correct
28 Correct 1 ms 2400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2404 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2488 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2488 KB Output is correct
9 Correct 1 ms 2400 KB Output is correct
10 Correct 0 ms 2400 KB Output is correct
11 Correct 0 ms 2400 KB Output is correct
12 Correct 1 ms 2552 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 0 ms 2396 KB Output is correct
17 Correct 1 ms 2484 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2404 KB Output is correct
20 Correct 1 ms 2408 KB Output is correct
21 Correct 1 ms 2404 KB Output is correct
22 Correct 1 ms 2504 KB Output is correct
23 Correct 1 ms 2408 KB Output is correct
24 Correct 1 ms 2408 KB Output is correct
25 Correct 1 ms 2396 KB Output is correct
26 Correct 1 ms 2396 KB Output is correct
27 Correct 1 ms 2648 KB Output is correct
28 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2652 KB Output is correct
2 Correct 3 ms 2752 KB Output is correct
3 Correct 11 ms 4440 KB Output is correct
4 Correct 9 ms 4528 KB Output is correct
5 Correct 5 ms 3408 KB Output is correct
6 Correct 5 ms 3364 KB Output is correct
7 Correct 8 ms 4436 KB Output is correct
8 Correct 8 ms 4188 KB Output is correct
9 Correct 5 ms 3160 KB Output is correct
10 Correct 5 ms 3160 KB Output is correct
11 Correct 9 ms 4504 KB Output is correct
12 Correct 12 ms 4440 KB Output is correct
13 Correct 5 ms 3420 KB Output is correct
14 Correct 5 ms 3420 KB Output is correct
15 Correct 7 ms 4004 KB Output is correct
16 Correct 7 ms 4124 KB Output is correct
17 Correct 8 ms 4444 KB Output is correct
18 Correct 8 ms 4252 KB Output is correct
19 Correct 8 ms 4444 KB Output is correct
20 Correct 8 ms 4444 KB Output is correct