Submission #538054

#TimeUsernameProblemLanguageResultExecution timeMemory
538054TaylorSwiftFangirlSpeedrun (RMI21_speedrun)C++17
100 / 100
205 ms904 KiB
#include <bits/stdc++.h> #include "speedrun.h" using namespace std; int read(int place) { int ans = 0; for(int i=0; i<10; i++) { ans*=2; ans += getHint(place*10+i+1); } return ans; } void write(int x, int place, int v) { for(int i=0; i<10; i++) { setHint(x, place*10+i+1, v&(1<<(9-i))); } } vector<int> adj[1004], path; void dfs(int x, int p) { path.push_back(x); write(x, 0, p); for(auto i : adj[x]) { if(i==p) continue; dfs(i, x); } } void assignHints(int st, int n, int a[], int b[]) { setHintLen(20); for(int i=1; i<n; i++) { adj[a[i]].push_back(b[i]); adj[b[i]].push_back(a[i]); } dfs(1, 0); for(int i=0; i<n-1; i++) { write(path[i], 1, path[i+1]); } } void speedrun(int st, int n, int start) { int curr = start; while(curr != 1) { int par = read(0); goTo(par); curr = par; } vector<int> depth{1}; while(true) { int child = read(1); if(child == 0) break; if(goTo(child)) { depth.push_back(child); } else { while(true){ depth.pop_back(); goTo(depth.back()); if(goTo(child)) { depth.push_back(child); break; } } } } }
#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...