# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
441112 | Quang | Dungeons Game (IOI21_dungeons) | C++17 | 0 ms | 0 KiB |
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;
void init(int n, std::vector<int> s, std::vector<int> p, std::vector<int> w, std::vector<int> l) {
n = s.size();
set<int> values;
for (auto u : s) {
values.insert(u);
}
for (int i = 0; i < n; i++) {
all_equal &= (s[i] == p[i]);
}
if (values.size() <= 5) {
}
}
long long SolveAllEqual(int x, int z) {
long long res = z;
int cur = x;
while (x != n) {
if (res >= s[x]) {
res += s[x];
x = w[x];
} else {
res += p[x];
x = l[x];
}
}
return res;
}
long long simulate(int x, int z) {
if (all_equal) return SolveAllEqual(x, z);
return 0;
}