제출 #818185

#제출 시각아이디문제언어결과실행 시간메모리
818185PixelCatDungeons Game (IOI21_dungeons)C++17
11 / 100
7074 ms33304 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 */
#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...