#include "speedrun.h"
#include <iostream>
#include <fstream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <cstdlib>
#include <cstdio>
#include <iterator>
#include <functional>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <bitset>
using namespace std;
#define pb push_back
vector<int> g[2000];
void dfs(int v = 1, int p = 0){
if (p){
for (int i = 1; i <= 20; ++i){
if ((1 << (i - 1)) & p){
setHint(v, i, 1);
}
}
}
for (auto to : g[v]){
if (to != p){
dfs(to, v);
}
}
}
void assignHints(int subtask, int N, int A[], int B[]) { /* your solution here */
setHintLen(20);
for (int i = 1; i < N; ++i){
int x = A[i], y = B[i];
g[x].pb(y);
g[y].pb(x);
}
dfs();
}
void dfs2(int v, int p){
for (auto to : g[v]){
if (to != p){
goTo(to);
dfs2(to, v);
}
}
if (p){
goTo(p);
}
}
void speedrun(int subtask, int N, int start) { /* your solution here */
while (start != 1){
int x = 0;
for (int j = 1; j <= 20; ++j){
int y = getHint(j);
x += ((1 << (j - 1)) * y);
}
goTo(x);
}
dfs2(1, 0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
47 ms |
760 KB |
Invalid node index to goTo |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
26 ms |
676 KB |
Invalid node index to goTo |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
53 ms |
684 KB |
Invalid node index to goTo |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
48 ms |
764 KB |
Invalid node index to goTo |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
38 ms |
688 KB |
Invalid node index to goTo |
2 |
Halted |
0 ms |
0 KB |
- |