Submission #818510

#TimeUsernameProblemLanguageResultExecution timeMemory
818510LittleCubeDungeons Game (IOI21_dungeons)C++17
25 / 100
218 ms222288 KiB
#include "dungeons.h" #include <bits/stdc++.h> #define ll long long #define pll pair<ll, ll> #define F first #define S second using namespace std; namespace { const int P = 25; int n, m; int id[7][50001][P]; ll go[7][50001][P]; map<ll, int> mp; vector<int> s, p, w, l; vector<ll> state; } 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; for (int i : s) mp[i] = 1; mp[0] = 1; mp[1e15] = 1; for (auto &[k, v] : mp) { v = m++; state.emplace_back(k); } for (int t = 0; t < m; t++) { for (int i = 0; i < n; i++) { if (s[i] < state[t]) go[t][i][0] = s[i], id[t][i][0] = w[i]; else go[t][i][0] = p[i], id[t][i][0] = l[i]; } go[t][n][0] = 0, id[t][n][0] = n; for (int k = 0; k + 1 < P; k++) for (int i = 0; i <= n; i++) go[t][i][k + 1] = go[t][i][k] + go[t][id[t][i][k]][k], id[t][i][k + 1] = id[t][id[t][i][k]][k]; } return; } ll simulate(int x, int _z) { ll z = _z; for (int t = 0; t< m; t++) { for (int k = P - 1; k >= 0; k--) if(z + go[t][x][k] < state[t]) z += go[t][x][k], x = id[t][x][k]; if(z < state[t]) z += go[t][x][0], x = id[t][x][0]; } return z; }
#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...