Submission #542854

#TimeUsernameProblemLanguageResultExecution timeMemory
542854AJ00Dungeons Game (IOI21_dungeons)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long
int N;
int simulate(int x, int z){
    int moves = 0;
    while(x != N){
        moves++;
        if (z >= s[x]){
            z += s[x];
            x = w[x];
        }
        else {
            z += p[x];
            x = l[x];
        }
    }
    return moves;
}
void init(int n, vector<int> _s, vector<int> _p, vector<int> _w,vector<int> _l){
    vector<int> s = _s;
    vector<int> p = _p;
    vector<int> w = _w;
    vector<int> l = _l;
    N = n;
}

Compilation message (stderr)

dungeons.cpp: In function 'long long int simulate(long long int, long long int)':
dungeons.cpp:9:18: error: 's' was not declared in this scope
    9 |         if (z >= s[x]){
      |                  ^
dungeons.cpp:11:17: error: 'w' was not declared in this scope
   11 |             x = w[x];
      |                 ^
dungeons.cpp:14:18: error: 'p' was not declared in this scope
   14 |             z += p[x];
      |                  ^
dungeons.cpp:15:17: error: 'l' was not declared in this scope
   15 |             x = l[x];
      |                 ^