传统题 1000ms 128MiB

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
20
3 3
1 15
17 23

Source

2019河南省赛

2019河南省ACM省赛重现

未参加
状态
已结束
规则
XCPC
题目
10
开始于
2019-8-9 20:00
结束于
2019-8-10 1:00
持续时间
5 小时
主持人
参赛人数
11