# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
612271 | StrawHatWess | 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 <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int>vi;
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x),end(x)
#define FOR(i,a,b) for(int i=a; i<b; i++)
#define ROF(i,a,b) for(int i=b-1; i>=a; i--)
//------------------------------------------------
int N;
vi s, p, w, l;
vector<ll>jump;
void init(int n, vi s, vi p, vi w, vi l) {
N=n;
::s=s; ::p=p; ::w=w; ::l=l;
jump.assign(N+1,0);
ROF(i,0,N){
jump[i]=s[i]+jump[w[i]];
}
FOR(i,0,N) cout <<
}
ll simulate(int st, int x){
int i=st;
ll X=x;
while(1){
if(i==N || X>=s[i]) break;
X+=p[i];
i=l[i];
}
X+=jump[i];
return X;
}
/*
3 2
2 6 9
3 1 2
2 2 3
1 0 1
0 1
2 3
24
25
*/