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 "speedrun.h"
#include<bits/stdc++.h>
#include<vector>
using namespace std;
vector<long long>v[2000], s;
long long n, fath[1005];
void dfs(long long vr,long long f)
{
s.push_back(vr);
fath[vr]=f;
for(int i=0;i<v[vr].size();i++)
{
if(v[vr][i]!=f)dfs(v[vr][i],vr);
}
}
void assignHints(int subtask, int N, int A[], int B[]) {
long long i,j;
setHintLen(20);
n=N;
for(i=1;i<N;i++)
{
v[A[i]].push_back(B[i]);
v[B[i]].push_back(A[i]);
}
dfs(1,-1);
for(i=0;i<n;i++)
{
long long f = fath[s[i]];
long long node = s[(i+1)%n];
for(j=1;j<=10;j++)
{
setHint(s[i],j,((1<<(j-1))&f));
setHint(s[i],j+10,((1<<(j-1))&node));
}
}
}
void speedrun(int subtask, int N, int start) {
int i,j;
for(i=1;i<=n;i++)
{
long long node=0;
for(j=11;j<=20;j++)
{
node=node|((getHint(j))<<(j-11));
}
while(!goTo(node))
{
long long f=0;
for(j=1;j<=10;j++)
{
f=f|((getHint(j))<<(j-1));
}
goTo(f);
}
}
}
Compilation message (stderr)
speedrun.cpp: In function 'void dfs(long long int, long long int)':
speedrun.cpp:13:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
13 | for(int i=0;i<v[vr].size();i++)
| ~^~~~~~~~~~~~~
# | 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... |