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;
int final;
vector<int>st,po,wi,lo;
void init(int n, vector<int> s, vector<int> p, vector<int> w, vector<int> l) {
final=n;
st=s;
po=p;
wi=w;
lo=l;
return;
}
ll simulate(int x, int z) {
// vector<int>s={2,6,9},p={3,1,2},w={2,2,3},l={1,0,1};
// init(3,s,p,w,l,x,z);
ll ans=z;
while(x!=final){
if(ans<st[x]){
ans+=po[x];
x=lo[x];
}else{
ans+=st[x];
x=wi[x];
}
}
return ans;
}
// int main(){
// int n=3,q=2;
// simulate(0,1);
// simulate(2,3);
// return 0;
// }
# | 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... |