#include "speedrun.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
void dfs(int x,int p){
//cout<<x<<' '<<p<<endl;
int to=0;
for (int i=1;i<=10;i++) if (getHint(i)) to+=(1<<(i-1));
if (to && to!=p) goTo(to),dfs(to,x);
to=0;
for (int i=11;i<=20;i++) if (getHint(i)) to+=(1<<(i-11));
if (to && to!=p) goTo(to),dfs(to,x);
if (p) goTo(p);
return;
}
void assignHints(int subtask, int n, int A[], int B[]) {
setHintLen(20);
vector<int> adj[n+2];
for (int i=1;i<n;i++) adj[A[i]].pb(B[i]),adj[B[i]].pb(A[i]);
for (int i=1;i<=n;i++){
int x=adj[i][0],y=0;
if (adj[i].size()==2) y=adj[i][1];
for (int j=0;j<10;j++) if (x&(1<<j)) setHint(i,j+1,1);
for (int j=0;j<10;j++) if (y&(1<<j)) setHint(i,j+11,1);
}return;
}
void speedrun(int subtask, int n, int start) {
dfs(start,0);
return;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
27 ms |
784 KB |
Solution didn't visit every node |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
9 ms |
744 KB |
Solution didn't visit every node |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
63 ms |
688 KB |
Output is correct |
2 |
Correct |
56 ms |
684 KB |
Output is correct |
3 |
Correct |
59 ms |
688 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
28 ms |
684 KB |
Solution didn't visit every node |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
28 ms |
692 KB |
Solution didn't visit every node |
2 |
Halted |
0 ms |
0 KB |
- |