# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
789566 | Mouad_ouj | Dungeons Game (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.
#include<bits/stdc++.h>
#include "dungeons"
#define int long long
using namespace std;
int ans=0,nn;
vector<int> se,le,pe,we;
void init(int n,vector<int> s,vector<int> p,vector<int> w,vector<int> l)
{
se.resize(n);
le.resize(n);
pe.resize(n);
we.resize(n);
nn=n;
se=s;
le=l;
we=w;
pe=p;
}
int self(int x,int z)
{
if(x==nn)
return z;
if(z>=se[x])
return self(we[x],z+se[x]);
if(z<se[x])
return self(le[x],z+pe[x]);
return 0ll;
}
int simulate(int x, int z)
{
return self(x,z);
}