# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
488175 | yungyao | 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.
using namespace std;
#pragma GCC optimize("Ofast")
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <set>
#include <map>
typedef long long LL;
typedef pair<int,int> pii;
#define F first
#define S second
#define pb push_back
#define mkp make_pair
#define iter(x) x.begin() x.end()
#define REP(n) for (int __=n;__--;)
#define REP0(i,n) for (int i=0;i<n;++i)
#define REP1(i,n) for (int i=1;i<=n;++i)
const int maxn = 5e4+10,mod = 0;
const LL inf = 0;
int ss[maxn],pp[maxn],ww[maxn],ll[maxn];
void init(int n,vector <int> s,vector <int> p,vector <int> w,vector <int> l){
REP0(i,n){
ss[i] = s[i];
pp[i] = p[i];
ww[i] = w[i];
ll[i] = l[i];
}
}
LL simulate(int x,int is){
LL z = is;
while (x != n){
if (z >= ss[x]){
z += ss[x];
x = ww[x];
}
else{
z += pp[x];
x = ll[x];
}
}
return z;
}