# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
454691 | ogibogi2004 | 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 "dungeons.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
const int MAXN=4e5+6;
int g1[MAXN];
int g2[MAXN];
int dp1[MAXN][20];
int dp2[MAXN][20];
int p1[MAXN][20];
int p2[MAXN][20];
int strength[MAXN];
int points[MAXN];
void init(int n, vector<int> s, vector<int> p, vector<int> w, vector<int> l) {
for(int i=0;i<n;i++)
{
points[i]=p[i];
strength[i]=s[i];
g1[i]=l[i];
g2[i]=w[i];
}
}
long long simulate(int x, int z) {
for(;;)
{
if(x==n)return;
if(z>=strength[x])
{
z+=strength[x];
x=g2[x];
}
else
{
z+=points[x];
x=g1[x];
}
}
return z;
}