#include "speedrun.h"
#include <bits/stdc++.h>
#include "grader.cpp"
using namespace std;
vector<int>path;
vector<vector<int>>adj;
void dfs1(int node,int parent)
{
path.push_back(node);
if(parent!=-1)
{
for(int i=0;i<20;i++)
{
if((1ll<<i)&parent)
setHint(node,i,1);
}
}
for(auto i:adj[node])
{
if(i==parent)
continue;
dfs1(i,node);
}
}
void assignHints(int subtask, int n, int a[], int b[]) {
setHintLen(20);
adj.resize(n+1);
for(int i=1;i<n;i++)
{
adj[a[i]].push_back(b[i]);
adj[b[i]].push_back(a[i]);
}
dfs1(1,-1);
// for(auto i:path)cout<<i<<" ";
// cout<<endl;
for(int i=0;i<path.size()-1;i++)
{
int lol=path[i+1];
for(int j=0;j<20;j++)
{
if((1ll<<j)&path[i+1])
{
setHint(path[i],j+10,1);
}
}
}
}
void dfs(int node,int parent,int start,int n)
{
//cout<<node<<endl;
for(auto i:adj[node])
{
if(i==parent)continue;
goTo(i);
dfs(i,node,start,n);
}
if(node!=start)
goTo(parent);
}
void speedrun(int subtask, int n, int start) { /* your solution here */
while(start!=1)
{
int lol=0;
for(int i=0;i<10;i++)
{
if(getHint(i))
lol+=(1ll<<i);
}
// cout<<"HI"<<" "<<lol<<endl;
start=lol;
goTo(lol);
}
int curnode=1;
while(1)
{
int lol=0;
for(int i=0;i<10;i++)
if(getHint(i+10))lol+=(1ll<<i);
if(lol==0)return;
//cout<<curnode<<endl;
while(!goTo(lol))
{
int parent=0;
// cout<<curnode<<" "<<lol<<" "<<goTo(lol)<<endl;
for(int i=0;i<10;i++)
{
if(getHint(i+10))parent+=(1ll<<i);
}
goTo(parent);
curnode=parent;
}
goTo(lol);
curnode=lol;
// if(cnt==5)break;
}
}
Compilation message
speedrun.cpp:3:10: fatal error: grader.cpp: No such file or directory
3 | #include "grader.cpp"
| ^~~~~~~~~~~~
compilation terminated.