#include "dungeons.h"
#include <vector>
using namespace std;
using ll = long long;
int N;
vector<int> S;
vector<int> P;
vector<int> W;
vector<int> L;
void init(int n, std::vector<int> s, std::vector<int> p, std::vector<int> w, std::vector<int> l) {
N = n;
S = s;
P = p;
W = w;
L = l;
}
long long simulate(int x, int z) {
ll curr_strength = z;
int curr_dung = x;
while (curr_dung != N)
{
if (curr_strength >= S[curr_dung])
{
curr_strength += S[curr_dung];
curr_dung = W[curr_dung];
}
else
{
curr_strength += P[curr_dung];
curr_dung = L[curr_dung];
}
}
return curr_strength;
}
# | 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... |