This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
using namespace std;
#pragma GCC optimize("Ofast")
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <set>
#include <map>
typedef long long LL;
typedef pair<int,int> pii;
#define F first
#define S second
#define pb push_back
#define mkp make_pair
#define iter(x) x.begin() x.end()
#define REP(n) for (int __=n;__--;)
#define REP0(i,n) for (int i=0;i<n;++i)
#define REP1(i,n) for (int i=1;i<=n;++i)
const int maxn = 5e4+10,mod = 0;
const LL inf = 0;
int ss[maxn],pp[maxn],ww[maxn],ll[maxn],N;
void init(int n,vector <int> s,vector <int> p,vector <int> w,vector <int> l){
N = n;
REP0(i,n){
ss[i] = s[i];
pp[i] = p[i];
ww[i] = w[i];
ll[i] = l[i];
}
}
LL simulate(int x,int is){
LL z = is;
while (x != N){
if (z >= ss[x]){
z += ss[x];
x = ww[x];
}
else{
z += pp[x];
x = ll[x];
}
}
return z;
}
# | 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... |