Submission #411186

# Submission time Handle Problem Language Result Execution time Memory
411186 2021-05-24T14:27:03 Z LouayFarah Rice Hub (IOI11_ricehub) C++14
0 / 100
456 ms 352 KB
#include "bits/stdc++.h"
#include "ricehub.h"
using namespace std;

long long S(int X[], int h, int l, int r)
{
    long long sum = 0;
    for(int i = l; i<=r; i++)
        sum = sum + abs(h-X[l]);
    return sum;
}

int besthub(int R, int L, int X[], long long B)
{
    int res = 0;

    for(int l = 0; l<R; l++)
    {
        for(int r = l+1; r<R; r++)
        {
            int h = X[(l+r)/2];
            long long curr = S(X, h, l, r);
            if(curr <=B)
                res = max(res, r-l+1);
        }
    }
    return res;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 216 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 456 ms 352 KB Output isn't correct
2 Halted 0 ms 0 KB -