Submission #1062686

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10626862024-08-17 09:51:02aufanDungeons Game (IOI21_dungeons)C++17
0 / 100
50 ms25176 KiB
#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};
}
}
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...