#include <bits/stdc++.h>
#ifdef MINA
#include "grader.cpp"
#endif
#include "speedrun.h"
using namespace std;
typedef int64_t ll;
void assignHints(int subtask, int n, int a[], int b[]) {
if (subtask == 1) {
vector<int> adj[n + 1];
for (int i = 1; i < n; i++) {
adj[a[i]].push_back(b[i]);
adj[b[i]].push_back(a[i]);
}
setHintLen(n);
for (int i = 1; i <= n; i++) {
for (auto nxt : adj[i]) {
setHint(i, nxt, 1);
}
}
}
}
void dfs(int i, int par, int n) {
for (int nxt = 1; nxt <= n; nxt++) {
if (nxt == par) continue;
if (getHint(nxt)) {
goTo(nxt);
dfs(nxt, i, n);
}
}
if (par) goTo(par);
}
void speedrun(int subtask, int n, int start) {
if (subtask == 1) {
dfs(start, 0, n);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
22 ms |
1492 KB |
Output is correct |
2 |
Correct |
22 ms |
1708 KB |
Output is correct |
3 |
Correct |
25 ms |
1380 KB |
Output is correct |
4 |
Correct |
22 ms |
1520 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
setHintLen was never called |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
setHintLen was never called |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
setHintLen was never called |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
setHintLen was never called |
2 |
Halted |
0 ms |
0 KB |
- |