This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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, true);
}
void dfs(int x, int prev = -1) {
for (int i = 0; i < n; i++) if (getHint(i)) 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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |