Submission #818184

#TimeUsernameProblemLanguageResultExecution timeMemory
818184PixelCat던전 (IOI21_dungeons)C++17
Compilation error
0 ms0 KiB
#include "dungeons.h" #ifdef NYAOWO #include "grader.cpp" #endif #include <bits/stdc++.h> #define For(i, a, b) for(int i = a; i <= b; i++) #define Forr(i, a, b) for(int i = a; i >= b; i--) #define F first #define S second #define sz(x) ((int)x.size()) #define all(x) x.begin(), x.end() #define eb emplace_back #define int LL using namespace std; using i32 = int32_t; using LL = long long; using pii = pair<int, int>; namespace { const int MAXN = 400'000; int N; int vw[MAXN + 10]; int vl[MAXN + 10]; int nxtw[MAXN + 10]; int nxtl[MAXN + 10]; void _init(i32 _n, vector<i32> _s, vector<i32> _p, vector<i32> _w, vector<i32> _l) { N = _n; For(i, 0, N - 1) { vw[i] = _s[i]; vl[i] = _p[i]; nxtw[i] = _w[i]; nxtl[i] = _l[i]; } } int query(int pos, int val) { while(pos != n) { if(val >= vw[pos]) { val += vw[pos]; pos = nxtw[pos]; } else { val += vl[pos]; pos = nxtl[pos]; } } return val; } } // namespace void init(i32 _n, std::vector<i32> _s, std::vector<i32> _p, std::vector<i32> _w, std::vector<i32> _l) { ::_init(_n, _s, _p, _w, _l); } long long simulate(i32 pos, i32 val) { return ::query(pos, val); } /* 3 2 2 6 9 3 1 2 2 2 3 1 0 1 0 1 2 3 24 25 */

Compilation message (stderr)

dungeons.cpp: In function 'LL {anonymous}::query(LL, LL)':
dungeons.cpp:42:15: error: 'n' was not declared in this scope
   42 |  while(pos != n) {
      |               ^