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 <bits/stdc++.h>
#include "speedrun.h"
using namespace std;
const int maxn = 1e3 + 2;
// vector <int> ad [maxn];
// bool ad [maxn][maxn];
void assignHints(int subtask, int N, int A[], int B[]) { /* your solution here */
setHintLen(N);
for (int i = 1; i < N; i++){
setHint(A[i], B[i], 1);
setHint(B[i], A[i], 1);
// ad[A[i]].push_back(B[i]);
// ad[B[i]].push_back(A[i]);
}
// for (int i = 1; i <= N; i++){
// for (int j = )
// }
}
void speedrun(int subtask, int N, int start) { /* your solution here */
int vis [N + 1] = {};
auto dfs = [&] (int u, int p = -1, auto&& dfs) -> void {
for (int i = 1; i <= N; i++){
if (i == p || i == start) continue;
if (getHint(i)) {
goTo(i);
dfs(i, u, dfs);
}
}
if (p != -1) goTo(p);
};
dfs(start, -1, dfs);
}
Compilation message (stderr)
speedrun.cpp: In function 'void speedrun(int, int, int)':
speedrun.cpp:22:9: warning: unused variable 'vis' [-Wunused-variable]
22 | int vis [N + 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... |