Submission #488175

#TimeUsernameProblemLanguageResultExecution timeMemory
488175yungyaoDungeons Game (IOI21_dungeons)C++17
Compilation error
0 ms0 KiB
using namespace std;
#pragma GCC optimize("Ofast")
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <set>
#include <map>

typedef long long LL;
typedef pair<int,int> pii;
#define F first
#define S second
#define pb push_back
#define mkp make_pair
#define iter(x) x.begin() x.end()
#define REP(n) for (int __=n;__--;)
#define REP0(i,n) for (int i=0;i<n;++i)
#define REP1(i,n) for (int i=1;i<=n;++i)

const int maxn = 5e4+10,mod = 0;
const LL inf = 0;

int ss[maxn],pp[maxn],ww[maxn],ll[maxn];
void init(int n,vector <int> s,vector <int> p,vector <int> w,vector <int> l){
    REP0(i,n){
        ss[i] = s[i];
        pp[i] = p[i];
        ww[i] = w[i];
        ll[i] = l[i];
    }
}

LL simulate(int x,int is){
    LL z = is;

    while (x != n){
        if (z >= ss[x]){
            z += ss[x];
            x = ww[x];
        }
        else{
            z += pp[x];
            x = ll[x];
        }
    }
    return z;
}

Compilation message (stderr)

dungeons.cpp: In function 'LL simulate(int, int)':
dungeons.cpp:39:17: error: 'n' was not declared in this scope
   39 |     while (x != n){
      |                 ^