Submission #411182

# Submission time Handle Problem Language Result Execution time Memory
411182 2021-05-24T14:13:42 Z LouayFarah Rice Hub (IOI11_ricehub) C++17
0 / 100
450 ms 356 KB
#include <bits/stdc++.h>
#include "ricehub.h"
using namespace std;
 
int S(int X[], int h, int l, int r)
{
    int 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 l = 0, r = R-1;
    int res = 0;
    for(int k = 1; k<=R; k++)
    {
        int l = 0;
        int r = k;
        while(r<=R)
        {
            int mid = (l+r)/2;
            int h = X[mid];
            int curr = S(X, h, l, r);
            if(curr<=B)
                res = max(res, k);
            r++, l++;
        }
    }
    return res;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Incorrect 1 ms 204 KB Output isn't correct
5 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 450 ms 356 KB Output isn't correct
2 Halted 0 ms 0 KB -