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 <vector>
#include <bits/stdc++.h>
using namespace std;
set<int> values;
bool all_equal = true;
int n;
vector<int> s, p, w, l;
void init(int N, std::vector<int> S, std::vector<int> P, std::vector<int> W, std::vector<int> L) {
s = S;
p = P;
w = W;
l = L;
n = N;
for (auto u : s) {
values.insert(u);
}
for (int i = 0; i < n; i++) {
all_equal &= (s[i] == p[i]);
}
}
long long SolveAllEqual(int x, int z) {
long long res = z;
while (x != n) {
if (res >= s[x]) {
res += s[x];
x = w[x];
} else {
res += p[x];
x = l[x];
}
}
return res;
}
long long SolveNaive() {
return 0;
}
long long simulate(int x, int z) {
return SolveAllEqual(x, z);
// if (all_equal) return SolveAllEqual(x, z);
// return SolveNaive();
}
# | 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... |