
86  ZOJ Monthly, January 2010  I
There're 2^{N} (1 <= N <= 10) QSes fighting for the job of admin in 218. It's hard for Fire to select who to be the admin, so he holds up a strange contest. Before the contest, each QS has a skill value V_{i} (V_{i} varies from person to person). And there's N rounds in the contest, that means they play single elimination rounds (refer to Single Elimination Tournament) in pairs. Moreover, i^{th} QS beat the j^{th} QS down, if and only if V_{i} > V_{j}. Please help the K^{th} (0 <= K < 2^{N}) QS to calculate the minimum and the maximum he/she can win. Input There're multiple test cases. For each test case, there're two integers N, K in the first line, then 2^{N} positive integers in the second line indicating V_{1}, ..., V_{2N}, and all of the skill values are less than 2^{31}. Output For each test case, output two integers indicating the minimal and the maximal number of wins that the Kth player can achieve. Sample Input 2 1 7 5 3 6 Sample Output 0 1 Author: OUYANG, Jialin Source: ZOJ Monthly, January 2010 