Submission #737063

#TimeUsernameProblemLanguageResultExecution timeMemory
737063mjhmjh1104Speedrun (RMI21_speedrun)C++17
21 / 100
52 ms848 KiB
#include "speedrun.h" #include <vector> using namespace std; int n; vector<int> adj[1006]; void assignHints(int subtask, int n, int a[], int b[]) { ::n = n; for (int i = 1; i < n; i++) { adj[a[i] - 1].push_back(b[i] - 1); adj[b[i] - 1].push_back(a[i] - 1); } setHintLen(n); for (int i = 0; i < n; i++) for (auto &j: adj[i]) setHint(i + 1, j + 1, true); } void dfs(int x, int prev = -1) { for (int i = 0; i < n; i++) if (getHint(i + 1)) adj[x].push_back(i); for (auto &i: adj[x]) if (i != prev) { goTo(i + 1); dfs(i, x); } if (prev != -1) goTo(prev + 1); } void speedrun(int subtask, int n, int st) { ::n = n; dfs(st - 1); }
#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...