Submission #1246703

#TimeUsernameProblemLanguageResultExecution timeMemory
1246703jer033Dungeons Game (IOI21_dungeons)C++20
11 / 100
7093 ms19780 KiB
#include "dungeons.h"
#include <vector>
using namespace std;
using ll = long long;

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

void init(int n, std::vector<int> s, std::vector<int> p, std::vector<int> w, std::vector<int> l) {
	N = n;
    S = s;
    P = p;
    W = w;
    L = l;
}

long long simulate(int x, int z) {
	  ll curr_strength = z;
    int curr_dung = x;
    while (curr_dung != N)
    {
        if (curr_strength >= S[curr_dung])
        {
            curr_strength += S[curr_dung];
            curr_dung = W[curr_dung];
        }
        else
        {
            curr_strength += P[curr_dung];
            curr_dung = L[curr_dung];
        }
    }
    return curr_strength;
}
#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...