# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1062686 | aufan | Dungeons Game (IOI21_dungeons) | C++17 | 50 ms | 25176 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "dungeons.h"
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
int n;
vector<int> s, p, w, l, dp;
vector<vector<pair<long long, int>>> bl;
void init(int N, vector<int> S, vector<int> P, vector<int> W, vector<int> L) {
n = N; s = S; p = P; w = W; l = L;
dp = vector<int>(n + 1, 0);
bl = vector<vector<pair<long long, int>>>(n, vector<pair<long long, int>>(25));
for (int i = n - 1; i >= 0; i--) dp[i] = dp[w[i]] + 1;
for (int i = 0; i < n; i++) bl[i][0] = {p[i], l[i]};
for (int j = 1; j < 25; j++) {
for (int i = 0; i < n; i++) {
auto [w, k] = bl[i][j - 1];
if (k == n) {
bl[i][j] = bl[i][j - 1];
} else {
auto [z, x] = bl[k][j - 1];
bl[i][j] = {w + z, x};
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |