#P7579. Find the Lighter Balls

    ID: 20773 Type: Default 1000ms 256MiB

Find the Lighter Balls

Find the Lighter Balls

rui_er bought n solid balls for physical training, but during shipping two balls that look similar turned out to be noticeably lighter. It is known that these two balls have equal mass and that the sum of their masses is greater than the mass of one normal ball. To avoid affecting his training, rui_er needs to identify the two lighter balls.

You have access to a balance scale. In each weighing you can place a set of balls on the left pan and another set on the right pan. The scale will tell you the relationship between the total masses on each side (using one of the symbols: $$). You are allowed at most $k$ weighings (where $k$ is a property of the test case).

Once you determine which two balls are lighter, you must output their indices in increasing order. In an interactive contest, you would perform weighings by printing commands like:

1 p a1 a2 ... ap q b1 b2 ... bq

and then later, when you have determined the answer, output:

2 x y

Here, p and q are the numbers of balls on the left and right pans, respectively, and the numbers following are the ball indices (all indices must be distinct in a weighing). Note that $1\leq x<y\leq n$.

Note: For simulation purposes, the input already provides the two indices corresponding to the lighter balls. Your task in this version is to simply read the input and output the two indices in increasing order.

inputFormat

The input consists of two lines:

  • The first line contains an integer n, the total number of balls.
  • The second line contains two integers, which are the indices of the two lighter balls.

In the interactive version, you would use up to k weighings to determine the answer. Here, however, the answer is provided directly.

outputFormat

Output a single line with two integers in increasing order, representing the indices of the two lighter (defective) balls.

sample

5
2 4
2 4