#include "speedrun.h"
#include <vector>
using namespace std;
int n;
vector<int> adj[1006];
void assign(int x, int y, int z) {
for (int i = 0; i < 10; i++) setHint(x + 1, y * 10 + i + 1, z & 1 << i ? true : false);
}
int get(int y) {
int ret = 0;
for (int i = 0; i < 10; i++) ret |= getHint(y * 10 + i + 1) << i;
return ret;
}
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(20);
for (int i = 0; i < n; i++) for (int j = 0; j < 2; j++) {
if (j < (int)adj[i].size()) assign(i, j, adj[i][j]);
else assign(i, j, 1023);
}
}
void dfs(int x, int prev = -1) {
for (int i = 0; i < 2; i++) if (get(i) != 1023) adj[x].push_back(get(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 |
1 |
Incorrect |
79 ms |
676 KB |
Solution didn't visit every node |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
170 ms |
764 KB |
Solution didn't visit every node |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
160 ms |
800 KB |
Output is correct |
2 |
Correct |
165 ms |
920 KB |
Output is correct |
3 |
Correct |
175 ms |
676 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
101 ms |
700 KB |
Solution didn't visit every node |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
101 ms |
672 KB |
Solution didn't visit every node |
2 |
Halted |
0 ms |
0 KB |
- |