Submission #813669

#TimeUsernameProblemLanguageResultExecution timeMemory
813669skittles1412Dungeons Game (IOI21_dungeons)C++17
11 / 100
7060 ms33172 KiB
#include "bits/extc++.h" using namespace std; template <typename T, typename... U> void dbgh(const T& t, const U&... u) { cerr << t; ((cerr << " | " << u), ...); cerr << endl; } #ifdef DEBUG #define dbg(...) \ cerr << "L" << __LINE__ << " [" << #__VA_ARGS__ << "]: "; \ dbgh(__VA_ARGS__) #else #define dbg(...) #define cerr \ if (false) \ cerr #endif using ll = long long; #define endl "\n" #define long int64_t #define sz(x) int(std::size(x)) struct Dungeon { int s, p, w, l; }; struct Solver { static constexpr int LOGN = 60; int n; vector<Dungeon> arr; Solver() {} Solver(const vector<Dungeon>& arr) : n(sz(arr)), arr(arr) {} long query(int u, long kv) { while (u != n) { if (kv >= arr[u].s) { kv += arr[u].s; u = arr[u].w; } else { kv += arr[u].p; u = arr[u].l; } } return kv; } } solver; void init(int n, vector<int> arr_s, vector<int> arr_p, vector<int> arr_w, vector<int> arr_l) { vector<Dungeon> arr; for (int i = 0; i < n; i++) { arr.push_back({arr_s[i], arr_p[i], arr_w[i], arr_l[i]}); } solver = Solver(arr); } ll simulate(int u, int kv) { return solver.query(u, kv); }
#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...