Special Formation
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
Problem Description
A
large number of new microbes have been found in an uninhabited island. Strangely,
these microbes, how ever active during the day, end up resting at night in the
following pattern. It’s very much like an infinite full binary search tree .
You
might as well number these microbes as 1,2,3.. .... In a subtree whose root
node is ith, we can get the minimum
number in this subtree by repeating going down the left node until the last
level, and we can also find the maximum number by going down the right node.
Now you are given some queries as "What are the minimum and maximum
numbers in the subtree whose root node is ith?"
Please try to find answers for there queries.
Input Format
The
first line contains an integer N,
which represents the number of queries (1≤
N ≤ 20). In the next N lines,
each contains a number representing a subtree with root number xi (2≤
xi ≤ 231 - 1).
Output Format
There are N lines in total, the i-th of which contains the answer for the i-th query.
3
3
8
203 3
1 15
17 23