제출 #794102

#제출 시각아이디문제언어결과실행 시간메모리
794102Johann던전 (IOI21_dungeons)C++17
0 / 100
1 ms340 KiB
#include "dungeons.h" #include "bits/stdc++.h" using namespace std; typedef long long ll; typedef vector<ll> vi; #define sz(x) (int)(x).size() int N; const ll INF = 1LL << 60; vi S, P; vector<int> W, L; vi dp; void init(int n, std::vector<int> s, std::vector<int> p, std::vector<int> w, std::vector<int> l) { N = n; S.resize(N), P.resize(N); W = w, L = l; for (int i = 0; i < N; ++i) S[i] = s[i], P[i] = p[i]; dp.assign(N + 1, INF); dp[N] = 0; for (int i = N - 1; i >= 0; --i) dp[i] = S[i] + dp[W[i]]; return; } long long simulate(int x, int z) { ll ans = z; if (ans < S[x]) ans += P[x], x = L[x]; assert(dp[x] != INF); return ans + dp[x]; }
#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...