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 <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
vector<pair<int, int>> G, W;
void init(int n, vi s, vi p, vi w, vi l) {
G = vector<pii>(n);
W = vector<pii>(n);
for (int i = 0; i < n; i++) {
G[i] = {w[i], l[i]};
W[i] = {s[i], p[i]};
}
}
ll simulate(int x, int z) {
int n = G.size();
ll strength = z;
for (int i = x; i != n; ) {
if (strength >= W[i].first) {
strength += W[i].first;
i = G[i].first;
} else {
strength += W[i].second;
i = G[i].second;
}
}
return 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... |