Submission #736707

#TimeUsernameProblemLanguageResultExecution timeMemory
736707flappybirdSpeedrun (RMI21_speedrun)C++17
100 / 100
292 ms836 KiB
#include "speedrun.h" #include <bits/stdc++.h> using namespace std; #define MAX 1010 namespace srun { int N; int ord[MAX]; void mark(int v, int x, int bias) { for (int i = 0; i < 10; i++) setHint(v, i + bias, (x >> i) & 1); } int get(int bias) { int ans = 0; for (int i = 0; i < 10; i++) if (getHint(i + bias)) ans |= (1 << i); return ans; } vector<int> adj[MAX]; int pv = 0; void dfs(int x, int p = 0) { if (pv) mark(pv, x, 1); pv = x; if (p) mark(x, p, 11); for (auto v : adj[x]) if (v != p) dfs(v, x); } } using namespace srun; void assignHints(int subtask, int _N, int A[], int B[]) { setHintLen(20); N = _N; int i; for (i = 1; i < N; i++) { adj[A[i]].push_back(B[i]); adj[B[i]].push_back(A[i]); } dfs(1); } void speedrun(int subtask, int N, int start) { int v = start; while (1) { int res = get(11); if (res) goTo(v = res); else break; } vector<int> st(1, 1); while (1) { int nxt = get(1); if (!nxt) return; while (!goTo(nxt)) { st.pop_back(); goTo(st.back()); } st.push_back(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...