Submission #562128

# Submission time Handle Problem Language Result Execution time Memory
562128 2022-05-14T06:17:54 Z four_specks Rice Hub (IOI11_ricehub) C++17
0 / 100
3 ms 836 KB
#include "ricehub.h"

#include <bits/stdc++.h>

using namespace std;

namespace
{
} // namespace

int besthub(int R, int L, int X[], long long B)
{
    vector<long> pref(R + 1, 0), suff(R + 1, 0);
    for (int i = 0; i < R; i++)
        pref[i + 1] = pref[i] + X[i];
    for (int i = R - 1; i >= 0; i--)
        suff[i] = suff[i + 1] + X[i];

    int res = 0;

    for (int i = 0; i < R; i++)
    {
        int lo = i, hi = R;
        while (lo < hi)
        {
            int mid = (lo + hi + 1) / 2;

            int m = (i + mid - 1) / 2;
            if (pref[mid] - pref[m] + suff[i] - suff[m] - (long)(mid - i) * X[m] <= B)
                lo = mid;
            else
                hi = mid - 1;
        }

        res = max(res, lo - i);
    }

    return res;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 836 KB Output isn't correct
2 Halted 0 ms 0 KB -