Submission #876811

# Submission time Handle Problem Language Result Execution time Memory
876811 2023-11-22T11:24:16 Z JakobZorz Rice Hub (IOI11_ricehub) C++14
0 / 100
2 ms 2748 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-num1;i++){
        if(num1*arr[i]-num2*arr[i]+ps[i+num2]-ps[i-num1]<=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 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2480 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2404 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2748 KB Output isn't correct
2 Halted 0 ms 0 KB -