Submission #457620

#TimeUsernameProblemLanguageResultExecution timeMemory
457620blueDungeons Game (IOI21_dungeons)C++17
11 / 100
7051 ms26648 KiB
#include "dungeons.h"
#include <vector>
using namespace std;

int N;
vector<int> S, P, W, L;

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
	return;
}

long long simulate(int x, int z)
{
	while(x != N)
    {
        if(z >= S[x])
        {
            z += S[x];
            x = W[x];
        }
        else
        {
            z += P[x];
            x = L[x];
        }
    }
    return z;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...