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>
#define ll long long
#define pb push_back
using namespace std;
#define maxn 400005
ll n;
vector<ll> g[maxn];
vector<ll> v[maxn];
ll a[maxn],b[maxn];
bool sub3 = 1;
void init(int N, vector<int> s, vector<int> p, vector<int> w, vector<int> l) {
n = N;
for(ll i = 1;i<=n;i++) a[i] = s[i-1];
for(ll i = 1;i<=n;i++) b[i] = p[i-1];
for(ll i = 1;i<n;i++) sub3&=(a[i]==a[i+1]);
for(ll i = 1;i<=n;i++){
if(sub3) v[w[i-1]+1].pb(i);
else v[i].pb(w[i-1]+1);
}
for(ll i = 1;i<=n;i++) g[i].pb(l[i-1]+1);
return;
}
long long simulate(int x, int z) {
x++;
if(!sub3){
while(x!=n+1){
if(z>=a[x]){
z+=a[x];
x = v[x][0];
}else{
z+=b[x];
x = g[x][0];
}
}
return z;
}
return 0;
}
/**
3 2
2 6 9
3 1 2
2 2 3
1 0 1
0 1
2 3
**/
# | 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... |