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;
typedef long long ll;
vector<ll> pw,pl,Gw,Gl;
int nd;
ll dfs(int u,int st){
if(u==nd)
return st;
if(st>pw[u]){
st=dfs(Gw[u],st+pw[u]);
}
else{
st=dfs(Gl[u],st+pl[u]);
}
return st;
}
void init(int n, std::vector<int> s, std::vector<int> p, std::vector<int> w, std::vector<int> l) {
nd=n;
for(int i=0;i<n;i++){
pw.push_back(s[i]);
pl.push_back(p[i]);
Gw.push_back(w[i]);
Gl.push_back(l[i]);
}
}
long long simulate(int x, int z) {
return dfs(x,z);
}
# | 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... |