Submission #316195

#TimeUsernameProblemLanguageResultExecution timeMemory
316195mohamedsobhi777Horses (IOI15_horses)C++14
Compilation error
0 ms0 KiB
#include "horses.h"
#include "grader.cpp"
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;

const int _N = 2e5 + 7, mod = 1e9 + 7;
const ll inf = 2e18;
int n, m;
ll X[_N], Y[_N];

ll mul(ll x, ll y)
{
        return 1ll * x * y % mod;
}

ll eval(int x)
{
        ll ret = 1ll;
        for (int i = 0; i <= x; ++i)
        {
                ret = mul(ret, X[i]);
        }
        return ret;
}

ll add(ll x, ll y)
{
        return (x + y >= mod ? x + y - mod : x + y);
}
ll solve()
{
        ll ret = 1ll;
        ll suf = 1ll;
        int i = n - 1;
        int cnt = 0;
        for (; ~i; --i)
        {
                suf = 1ll * suf * X[i];
                //cnt += (X[i] > 1);
                if (suf >= 2e9)
                        break;
        }
        ret = eval(i - 1);
        ll all = 1ll;
        ll Max = 1ll;
        for (i++; i < n; ++i)
        {
                //  cout << i << " " << all << " " << Y[i] << "*\n";
                all *= X[i];
                Max = max(Max, 1ll * all * Y[i]);
        }
        //cout << "\n";
        return mul(ret, Max);
}

int init(int N, int _X[], int _Y[])
{
        n = N;
        for (int i = 0; i < N; ++i)
        {
                X[i] = _X[i];
                Y[i] = _Y[i];
        }
        return solve();
}

int updateX(int pos, int val)
{
        X[pos] = val;
        return solve();
}

int updateY(int pos, int val)
{
        Y[pos] = val;
        return solve();
}

Compilation message (stderr)

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