# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
765255 | vjudge1 | Speedrun (RMI21_speedrun) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "speedrun.h"
using namespace std;
const int MAXN=1e3+5;
vector<int> sos[MAXN][MAXN];
int cnt[MAXN];
vector<vector<int> > g(MAXN);
void assignHints(int subtask, int N, int A[], int B[]) {
setHintLen(20);
for(int i=1; i<N; i++) {
g[A[i]].push_back(B[i]);
g[B[i]].push_back(A[i]);
}
for(int i=1; i<=N; i++) {
for(auto to : g[i])setHint(i, to, 1);
}
return;
}
int us[MAXN];
void dfs(int v, int p, int N) {
us[v]=1;
vector<int> gg;
for(int j=1; j<=N; j++) {
if(getHint(j))gg.pb(j);
}
for(auto to : gg) {
if(!us[to]) {
goTo(to);
dfs(to, v, N);
}
}
if(v!=p)goTo(p);
else return;
}
void speedrun(int subtask, int N, int start) {
int len=getLength();
dfs(start, start, N);
return;
}