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;
#define n N
#define s S
#define p P
#define w W
#define l L
#define int long long
#define pb push_back
int n;
vector<int> win_str, lose_str, win_pos, lose_pos;
void solve() {
//
}
int query(int pos, int strength) {
while(pos != n) {
if(strength < win_str[pos]) {
strength += lose_str[pos];
pos = lose_pos[pos];
} else {
strength += win_str[pos];
pos = win_pos[pos];
}
}
return strength;
}
#undef n
#undef s
#undef p
#undef w
#undef l
void init(signed n, vector<signed> s, vector<signed> p, vector<signed> w, vector<signed> l) {
N = n;
win_str = lose_str = win_pos = lose_pos = (vector<int> (n + 1, 0));
for(int i = 0; i < n; i++) {
win_str[i] = s[i];
lose_str[i] = p[i];
win_pos[i] = w[i];
lose_pos[i] = l[i];
}
win_str[n] = 0;
lose_str[n] = 0;
win_pos[n] = n;
lose_pos[n] = n;
solve();
}
int simulate(signed x, signed z) {
return query(x, 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... |