#include <bits/stdc++.h>
#include "speedrun.h"
using namespace std;
void assignHints (int subtask, int n, int a[], int b[]) {
setHintLen(n);
bool adj[n + 1][n + 1]; memset(adj, 0, sizeof(adj));
for (int i = 1; i < n; i++) {
adj[a[i]][b[i]] = adj[b[i]][a[i]] = 1;
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
if (adj[i][j]) setHint(i, j, adj[i][j]);
}
}
return;
}
int n;
void dfs (int pos, int par) {
for (int j = 1; j <= n; j++) {
if (j == par || pos == j) continue;
if (getHint(j) == 1) {
goTo(j); dfs(j, pos); goTo(pos);
}
}
}
void speedrun (int subtask, int N, int start) {
n = N;
dfs(start, -1);
return;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
2544 KB |
Output is correct |
2 |
Correct |
25 ms |
1960 KB |
Output is correct |
3 |
Correct |
25 ms |
2320 KB |
Output is correct |
4 |
Correct |
23 ms |
2196 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
The length is too large |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
596 KB |
The length is too large |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
The length is too large |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
The length is too large |
2 |
Halted |
0 ms |
0 KB |
- |