#include "speedrun.h"
#include <bits/stdc++.h>
#include <vector>
#include <stack>
using namespace std;
const int NMAX = 1001;
vector<int> adj[NMAX];
stack<int> ord;
void setPar (int nod , int par)
{
int bit = 1;
while (par)
{
setHint(nod , bit , par&1);
bit++;
par /= 2;
}
}
void setNext (int nod , int nxt)
{
int bit = 11;
while (nxt)
{
setHint(nod , bit , nxt&1);
bit++;
nxt /= 2;
}
}
void dfs (int nod = 1 , int par = 0)
{
ord.push(nod);
for (auto& to : adj[nod])
{
if (to == par) continue;
setPar(to , nod);
dfs(to , nod);
}
}
void assignHints(int subtask, int N, int A[], int B[])
{
setHintLen(20);
for (int i = 1; i < N; i++)
{
adj[A[i]].push_back(B[i]);
adj[B[i]].push_back(A[i]);
}
dfs();
int prev = 1;
while (ord.size())
{
setNext(ord.top() , prev);
prev = ord.top();
ord.pop();
}
}
int getPar (int nod)
{
int par = 0;
for (int bit = 1; bit <= 10; bit++)
{
par = (par << 1) + getHint(bit);
}
return par;
}
int getNext (int nod)
{
int nxt = 0;
for (int bit = 11; bit <= 20; bit++)
{
nxt = (nxt << 1) + getHint(bit);
}
return nxt;
}
void speedrun(int subtask, int N, int start)
{
vector<bool> viz(N+1, 0);
int visited = 0;
int crt = start;
while (visited < N)
{
int par = getPar(crt);
int nxt = getNext(crt);
if (goTo(nxt) == 0) goTo(par);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
113 ms |
728 KB |
Used too many wrong interactions |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
114 ms |
772 KB |
Used too many wrong interactions |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
114 ms |
776 KB |
Used too many wrong interactions |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
289 ms |
724 KB |
Used too many wrong interactions |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
113 ms |
736 KB |
Used too many wrong interactions |
2 |
Halted |
0 ms |
0 KB |
- |