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 <cmath>
#include <iostream>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <string>
#include <fstream>
#include "dungeons.h"
using namespace std;
vector<int>nextwin,nextlos,stre,los;
int N;
void init(int n, std::vector<int> s, std::vector<int> p, std::vector<int> w, std::vector<int> l) {
nextwin.resize(n);
N=n;
for(int i=0;i<n;i++){
nextwin[i]=w[i];
}
nextlos.resize(n);
for(int i=0;i<n;i++){
nextlos[i]=l[i];
}
stre.resize(n);
for(int i=0;i<n;i++){
stre[i]=s[i];
}
los.resize(n);
for(int i=0;i<n;i++){
los[i]=l[i];
}
return;
}
long long simulate(int x, int z) {
long long int pow=z;
int act=z;
while(act!=N){
if(pow>=stre[act]){
pow+=stre[act];
act=nextwin[act];
}
else{
pow+=los[act];
act=nextlos[act];
}
}
return pow;
}
# | 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... |