# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
472852 | blue | Dungeons Game (IOI21_dungeons) | C++17 | 7021 ms | 41088 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 <iostream>
using namespace std;
const int maxN = 50'000;
int N;
vector<int> S, P, W, L;
vector<long long> winscore(1+maxN, 0LL);
void init(int n, vector<int> s, vector<int> p, vector<int> w, vector<int> l)
{
N = n; //number of opponents
S = s; //strength of opponent i == strength increase upon winning
P = p; //strength increase upon losing
W = w; //winning move
L = l; //losing move
for(int i = N-1; i >= 0; i--)
winscore[i] = winscore[ W[i] ] + S[i];
return;
}
long long simulate(int x, int z)
{
// cerr << x << ' ' << z << '\n';
long long Z = z;
while(x != N && Z < 10'000'000)
{
if(Z >= S[x])
{
Z += S[x];
x = W[x];
}
else
{
Z += P[x];
x = L[x];
}
// cerr << x << ' ' << Z << '\n';
}
return Z + winscore[x];
}
Compilation message (stderr)
# | 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... |