Submission #398487

# Submission time Handle Problem Language Result Execution time Memory
398487 2021-05-04T11:40:09 Z iulia13 Rice Hub (IOI11_ricehub) C++14
Compilation error
0 ms 0 KB
#include <iostream>
#include <vector>
#include "ricehub"
using namespace std;
const int nmax = 1e5 + 5;
#define ll long long
ll pref[nmax];
ll suf[nmax];
int besthub(int n, int l, vector <int> v, ll b)
{
    int i;
    for (i = 0; i < n; i++)
        pref[i] = pref[i - 1] + 1ll * v[i];
    int st = 1, dr = n, sol = 0;
    while (st <= dr)
    {
        int mid = (st + dr) / 2, ok = 1;
        for (i = 0; ok && i < n - mid + 1; i++)
        {
            ///de la i la i + mid - 1
            int poz = mid / 2 + i - 1;
            ll money = 1ll * (poz - i) * v[poz] - 1ll * (i + mid - 1 - poz) * v[poz];
            money -= (pref[poz - 1] - pref[i - 1]);
            money += pref[i + mid - 1] - pref[poz];
            if (money <= b)
                ok = 0;
        }
        if (!ok)
        {
            sol = mid;
            st = mid + 1;
        }
        else
            dr = mid - 1;
    }
    return sol;
}
vector <int> dani;/*
int main()
{
    int r, l;
    cin >> r >> l;
    dani.resize(r);
    for (int i = 0; i < r; i++)
        cin >> dani[i];
    ll b;
    cin >> b;
    cout << besthub(r, l, dani, b);
    return 0;
}*/

Compilation message

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