제출 #793476

#제출 시각아이디문제언어결과실행 시간메모리
793476mathematik던전 (IOI21_dungeons)C++17
11 / 100
5791 ms2097152 KiB
#include "dungeons.h" #include <bits/stdc++.h> #define ll long long using namespace std; vector<vector<vector<vector<int>>>> binary;//index, +, max excluded void init(int n, vector<int> s, vector<int> p, vector<int> w, vector<int> l) { s.push_back(0); p.push_back(0); w.push_back(n); l.push_back(n); n++; for (int range = 0; range < 25; range++) { ll r = 1 << range; vector<vector<vector<int>>> t = vector<vector<vector<int>>>(n, vector<vector<int>>(25)); for (int i = 0; i < n; i++) { if (s[i] <= r) { t[i][0] = {w[i], s[i], INT_MAX}; } else { t[i][0] = {l[i], p[i], s[i]}; } } for (int i = 1; i < 25; i++) { for (int ind = 0; ind < n; ind++) { int pointer = t[ind][i - 1][0]; t[ind][i] = {t[pointer][i - 1][0], t[ind][i - 1][1] + t[pointer][i - 1][1], min(t[ind][i - 1][2], t[pointer][i - 1][2] - t[ind][i - 1][1])}; t[ind][i][1] = min(100000000, t[ind][i][1]); t[ind][i][2] = max(t[ind][i][2], 0); } } binary.push_back(t); } } long long simulate(int x, int z) { ll t = z; for (int r = 0; r < 24; r++) { for (int s = 24; s >= 0; s--) { if (binary[r][x][s][2] > t) { t += binary[r][x][s][1]; x = binary[r][x][s][0]; } } } t += binary[24][x][24][1]; return t; }
#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...