이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |