# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
488147 | 8e7 | 던전 (IOI21_dungeons) | 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.
//Challenge: Accepted
#include "dna.h"
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
using namespace std;
void debug(){cout << endl;}
template<class T, class ... U> void debug(T a, U ... b){cout << a << " ", debug(b...);}
template<class T> void pary(T l, T r) {
while (l != r) cout << *l << " ", l++;
cout << endl;
}
#define ll long long
#define maxn 100005
#define pii pair<int, int>
#define ff first
#define ss second
#define io ios_base::sync_with_stdio(0);cin.tie(0);
int n;
vector<int> s, p, w, l;
void init(int nv, vector<int> sv, vector<int> pv, vector<int> wv, vector<int> lv) {
n = nv;
s = sv, p = pv, w = wv, l = lv;
}
long long simulate(int x, int z) {
ll ans = z;
while (x != n) {
if (ans > s[x]) ans += s[x], x = w[x];
else ans += p[x], x = l[x];
}
return ans;
}