#include <bits/stdc++.h>
#include "speedrun.h"
using namespace std;
vector <int> conv (int x) {
vector <int> dd;
for (int i = 9; i >= 0; i--) {
dd.push_back((x >> i) & 1);
}
return dd;
}
void assignHints (int subtask, int n, int a[], int b[]) {
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(20);
for (int i = 1; i <= n; i++) {
auto d = conv(adj[i][0]);
for (int l = 1; l <= 10; l++) {
setHint(i, l, d[l - 1]);
}
if (adj[i].size() == 1) continue;
d = conv(adj[i][1]);
for (int l = 1; l <= 10; l++) {
setHint(i, l + 10, d[l - 1]);
}
}
}
int n;
void dfs (int pos, int par) {
if (pos == 6) exit(0);
int x = 0;
for (int i = 1; i <= 10; i++) {
x *= 2; x += getHint(i);
}
if (x != 0 && x != par) {
goTo(x); dfs(x, pos); goTo(pos);
}
x = 0;
for (int i = 11; i <= 20; i++) {
x *= 2; x += getHint(i);
}
if (x != 0 && x != par) {
goTo(x); dfs(x, pos); goTo(pos);
}
}
void speedrun (int subtask, int N, int start) {
dfs(start, -1);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
62 ms |
684 KB |
Solution didn't visit every node |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
40 ms |
684 KB |
Solution didn't visit every node |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
102 ms |
1196 KB |
Solution didn't visit every node |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
86 ms |
696 KB |
Solution didn't visit every node |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
60 ms |
944 KB |
Solution didn't visit every node |
2 |
Halted |
0 ms |
0 KB |
- |