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 string str;
typedef vector<int> vi;
int n;
vi s, p, w, l;
vector<bool> proc;
void init(int n1, std::vector<int> s1, std::vector<int> p1, std::vector<int> w1, std::vector<int> l1)
{
n = n1;
s = s1;
p = p1;
w = w1;
l = l1;
proc = vector<bool>(n + 1, false);
}
long long simulate(int x, int z)
{
if (z >= s[0])
return z + count(proc.begin(), proc.end(), false) * s[0];
proc[x] = true;
if (x == n)
return z;
if (z >= s[x])
return simulate(w[x], z + s[x]);
else
return simulate(l[x], z + p[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... |