Submission #763365

# Submission time Handle Problem Language Result Execution time Memory
763365 2023-06-22T08:36:18 Z boris_mihov Rice Hub (IOI11_ricehub) C++17
Compilation error
0 ms 0 KB
#include "grader.h"
#include <algorithm>
#include <iostream>
#include <numeric>
#include <cassert>
#include <vector>

typedef long long llong;
const int MAXN = 100000 + 10;
const int INF  = 1e9;

int n;
llong b;
int a[MAXN];
llong prefix[MAXN];

bool check(int needed)
{
    for (int i = 1 ; i + needed - 1 <= n ; ++i)
    {
        llong currCost = 0;
        int med = (i + i + needed - 1) / 2;
        currCost += 1LL * (med - i + 1) * a[med] - (prefix[med] - prefix[i - 1]);
        currCost += (prefix[i + needed - 1] - prefix[med]) - 1LL * (i + needed - 1 - med) * a[med];
        if (currCost <= b) return true;
    }

    return false;
}

int besthub(int N, int L, int X[], long long B)
{
    n = N;
    for (int i = 0 ; i < n ; ++i)
    {
        a[i + 1] = X[i];
        prefix[i + 1] = prefix[i] + X[i];
    }

    b = B;
    int l = 0, r = n + 1, mid;
    while (l < r - 1)
    {
        mid = (l + r) / 2;
        if (check(mid)) l = mid;
        else r = mid;
    }

    return l;
}

Compilation message

ricehub.cpp:1:10: fatal error: grader.h: No such file or directory
    1 | #include "grader.h"
      |          ^~~~~~~~~~
compilation terminated.