Speedrun

아직 제출이 없습니다시간 제한10초메모리 제한1024 MB

문제

Marcel started doing speedruns, in hopes to get a new Wr (World Record). Sadly, he cannot master the newly discovered strats, so he has to find a way to gain an unfair advantage.

The game he’s trying to get good at is called Tree Souls III, and he’s trying to get a Wr in the full-tree% category.

The game takes place, as the name implies, on a tree (i.e. a graph with NN vertices, numbered from 11 to NN, and N1N - 1 edges, such that there are no cycles).

The game works as follows: the character is placed in an arbitrary node inside the tree. He can choose an integer xx, and try to walk from the node he’s in to the node xx. If there is an edge between xx and the node he’s standing in, he will move to xx, otherwise nothing happens. His speedrun is valid if he visits each node at least once.

Now, here comes the cheating part: since he doesn’t know the edge-teleportation-glitch, he is going to set the seed for his world, therefore, he will know how the tree looks like before starting the run. If he just memorizes the tree, it will be too obvious that he’s cheating, so he will be instantly banned from the speedrunning community, therefore he will just put some hints in each node (by tampering with the code). A hint is a binary string of size ll (ll is the same for every hint in each node). When he sits on a node, he can read the hint assigned to the node he’s currently in.

제한

  • 1N1,0001 ≤ N ≤ 1\\,000
  • Let QQ be the number of calls to goTo which returned false. In what follows we outline constraints for ll and QQ that must be respected in order to earn score for each subtask.