• 沒有找到結果。

teams take part. The winners of each round proceed to the next round. So in round 1 there are 2

N/A
N/A
Protected

Academic year: 2021

Share "teams take part. The winners of each round proceed to the next round. So in round 1 there are 2"

Copied!
2
0
0

加載中.... (立即查看全文)

全文

(1)

10666 The Eurocup is Here!

We are the champions of the Eurocup! Well …almost. Actually, we lost in first round and didn’t win any match. But we were beaten by the real champions so, optimistically, we could be the second! Cup competitions are always unfair …

Let’s consider a cup competition, that consists of N rounds where 2

N

teams take part. The winners of each round proceed to the next round. So in round 1 there are 2

N

teams, in round 2 there are 2

N−1

teams, and so on. Teams are numbered 0, 1, 2, . . . , 2

N

− 1. The matches in each round are scheduled according to this order. Assume that, when two teams play, the one with the lowest number always wins. In conclusion, in round 1 the matches are: (0 vs. 1), (2 vs. 3), (4 vs.5), …; in round 2: (0 vs. 2), (4 vs. 6), …The situation for N = 3 is shown in the picture below.

A team, X, is better than all the teams it has beaten, and it is worse than all the teams it has lost with. Moreover, we can apply a sort of transitivity: X is better than all the team that are worse than the teams that are worse than X; and X is worse than the teams that are better than the teams that are better than X. For example, in the case of N = 3, team 7 is worse than 6, 4 and 0.

When the competition is finished, all teams are given a ranking from 1 to 2

N

(different for each team, 1 for the winner, 2 for the subchampion, etc.). The ranking of team X is R(X). A valid ranking has the following property: if X is better than Y , then R(X) < R(Y ). Obviously, there are many possible valid rankings (because there are pairs of teams that we have no information between them). We define the optimistic classification of a team X as the smallest value of R(X) for any valid ranking R. Similarly, the pessimistic classification of X is the biggest value of R(X) for any valid ranking R.

Given the number of rounds, N , and the number of a team, X, you have to compute the optimistic and pessimistic classification of X.

Input

The first line of the input contains an integer M , indicating the number of test cases. Each test case consists of two integers N and X. N is the total number of rounds in the competition (0 < N < 31), and X is the number of a team (0 ≤ X ≤ 2

N

− 1).

Output

For each test case, the output should consist of a single line with two integers: the optimistic and the

pessimistic classification of the corresponding team.

(2)

Universidad de Valladolid OJ: 10666 – The Eurocup is Here! 2/2

Sample Input 4

3 1 4 10 2 2 4 15

Sample Output 2 8

3 15

2 3

5 16

參考文獻

相關文件

You are given the wavelength and total energy of a light pulse and asked to find the number of photons it

Reading Task 6: Genre Structure and Language Features. • Now let’s look at how language features (e.g. sentence patterns) are connected to the structure

Wang, Solving pseudomonotone variational inequalities and pseudocon- vex optimization problems using the projection neural network, IEEE Transactions on Neural Networks 17

volume suppressed mass: (TeV) 2 /M P ∼ 10 −4 eV → mm range can be experimentally tested for any number of extra dimensions - Light U(1) gauge bosons: no derivative couplings. =&gt;

Define instead the imaginary.. potential, magnetic field, lattice…) Dirac-BdG Hamiltonian:. with small, and matrix

incapable to extract any quantities from QCD, nor to tackle the most interesting physics, namely, the spontaneously chiral symmetry breaking and the color confinement.. 

• Formation of massive primordial stars as origin of objects in the early universe. • Supernova explosions might be visible to the most

(Another example of close harmony is the four-bar unaccompanied vocal introduction to “Paperback Writer”, a somewhat later Beatles song.) Overall, Lennon’s and McCartney’s