#include <iostream>
#include <vector>
using namespace std;
#include "speedrun.h"
const int NMAX = 1000;
vector<int> edges[NMAX + 1];
int parent[NMAX + 1];
int nextInOrder[NMAX + 2];
int orderTime;
void dfs(int node, int par) {
parent[node] = par;
nextInOrder[orderTime++] = node;
for(auto child : edges[node]) {
if(child != par)
dfs(child, node);
}
}
void assignHints (int subtask , int N, int A[], int B[]) {
for(int i = 1; i <= N - 1; i++) {
edges[A[i]].push_back(B[i]);
edges[B[i]].push_back(A[i]);
}
int l = 10;
setHintLen(2 * l);
orderTime = 1;
dfs(1, 0);
nextInOrder[N + 1] = 1;
for(int i = 1; i <= N; i++) {
for(int bit = 0; bit < l; bit++) {
setHint(nextInOrder[i], bit + 1, parent[nextInOrder[i]] & (1 << bit));
setHint(nextInOrder[i], bit + l + 1, nextInOrder[i + 1] & (1 << bit));
}
}
}
void speedrun(int subtask , int N, int start ) {
/*int node = start;
int l = getLength ();
for(int i = 1; i <= N - 1; i++) {
int par, nextNode;
par = nextNode = 0;
for(int bit = 0; bit < l; bit++) {
par += (1 << bit) * getHint(bit + 1);
nextNode += (1 << bit) * getHint(bit + 1 + l);
}
while(goTo(nextNode) == false) {
node = par;
goTo(node);
par = 0;
for(int bit = 0; bit < l; bit++)
par += (1 << bit) * getHint(bit + 1);
}
node = nextNode;
}*/
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
101 ms |
880 KB |
Solution didn't visit every node |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
77 ms |
884 KB |
Solution didn't visit every node |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
93 ms |
896 KB |
Solution didn't visit every node |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
89 ms |
1140 KB |
Solution didn't visit every node |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
84 ms |
880 KB |
Solution didn't visit every node |
2 |
Halted |
0 ms |
0 KB |
- |