This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "dungeons.h"
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
#define sz(x) (int)(x).size()
int N;
const ll INF = 1LL << 60;
vi S, P, W, L;
vi dp;
void init(int n, std::vector<int> s, std::vector<int> p, std::vector<int> w, std::vector<int> l)
{
N = n;
for (int i = 0; i < N; ++i)
S[i] = s[i], P[i] = p[i], W[i] = w[i], L[i] = l[i];
dp.assign(N + 1, INF);
dp[N] = 0;
for (int i = N - 1; i >= 0; --i)
dp[i] = S[i] + dp[W[i]];
return;
}
long long simulate(int x, int z)
{
if (z < S[x])
z += P[x], x = L[x];
return z + dp[x];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |