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;
vector <long long> a, b, win, lose;
void init(int n, vector <int> s, vector <int> p, vector <int> w, vector <int> l)
{
for (int i = 0; i < n; ++i) {
a.push_back(s[i]);
b.push_back(p[i]);
win.push_back(w[i]);
lose.push_back(l[i]);
}
}
long long simulate(int x, int z)
{
long long cur = z, d = x;
while (1) {
if (d == (long long)a.size()) {
break;
}
if (cur >= a[d]) {
cur += a[d];
d = win[d];
}
else {
cur += b[d];
d = lose[d];
}
}
return cur;
}
# | 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... |