Submission #543939

#TimeUsernameProblemLanguageResultExecution timeMemory
543939eecsSpeedrun (RMI21_speedrun)C++17
0 / 100
186 ms748 KiB
#include "speedrun.h" #include <bits/stdc++.h> using namespace std; void assignHints(int, int n, int *U, int *V) { setHintLen(20); vector<vector<int>> G(n + 1); for (int i = 1; i < n; i++) { G[U[i]].push_back(V[i]), G[V[i]].push_back(U[i]); } int lst = 0; function<void(int, int)> dfs = [&](int u, int fa) { if (lst) for (int i = 0; i < 10; i++) setHint(lst, i + 1, u >> i & 1); lst = u; for (int i = 0; i < 10; i++) setHint(u, i + 11, fa >> i & 1); for (int v : G[u]) if (v ^ fa) dfs(v, u); }; dfs(1, 0); setHint(lst, 1, 1); } void speedrun(int, int n, int s) { while (1) { int fa = 0; for (int i = 0; i < 10; i++) if (getHint(i + 1)) fa |= 1 << i; if (s == fa) break; if (!goTo(fa)) { int nxt = 0; for (int i = 0; i < 10; i++) if (getHint(i + 11)) nxt |= 1 << i; goTo(nxt); } } }
#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...