Tree Search
시간 제한1초메모리 제한1024 MB
노드가 10만 개 이하인 이진 트리에서 술래 노드를 찾기 위해 부분 트리 포함 여부 질문을 35번 이하로 던져야 합니다.
문제
You are given a rooted binary tree consisting of vertices. The vertices are numbered from to , the root is the vertex number . Each of the other vertices has a single parent in the tree. The tree is binary, i.e. each vertex can be a parent of at most two other vertices.
One of the vertices is special. You are trying to guess it. You can ask the questions of the following kind: "Is the special vertex in the subtree of vertex "? A node is in the subtree of vertex if and only if the shortest path between and goes through vertex . Note that vertex is also in its own subtree.
You are allowed to ask this question at most times. After that you should report your guess.
제한
예제
이 문제는 공개된 예제가 없습니다.