# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1013472 | vjudge1 | Mutating DNA (IOI21_dna) | C++17 | 0 ms | 0 KiB |
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 <vector>
#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> s, p, w, 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;
return;
}
long long simulate(int x, int z) {
long long ans = z;
while(x != n){
if(ans >= s[x]) {
ans += s[x];
x = w[x];
} else {
ans += p[x];
x = l[x];
}
}
return ans;
}