Submission #542855

#TimeUsernameProblemLanguageResultExecution timeMemory
542855AJ00Dungeons Game (IOI21_dungeons)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long
int N;
vector<int> s,p,w,l
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){
    s = _s;
    p = _p;
    w = _w;
    l = _l;
    N = n;
}

Compilation message (stderr)

dungeons.cpp:3:13: error: expected initializer before 'long'
    3 | #define int long long
      |             ^~~~
dungeons.cpp:6:1: note: in expansion of macro 'int'
    6 | int simulate(int x, int z){
      | ^~~
dungeons.cpp: In function 'void init(long long int, std::vector<long long int>, std::vector<long long int>, std::vector<long long int>, std::vector<long long int>)':
dungeons.cpp:25:5: error: 'l' was not declared in this scope
   25 |     l = _l;
      |     ^