| Abakoda Long Contest 2022 |
|---|
| Finished |
This is an interactive problem.
This year, Alice decided to take an internship at the Gates to the Underworld, under the supervision of the Egyptian God of Death, Anubis.
She assists Anubis in weighing the hearts of the deceased in order to determine whose souls are worthy of entering the realm of the dead. Each heart is weighed against a feather of Ma'at, the goddess of truth, using a pair of balance scales. Those with hearts lighter than the feather get to enter the underworld; those with hearts heavier than the feather have their souls devoured by the goddess Ammit.
But Alice has an ambitious goal — what if they can precisely numerically measure the weight of each heart? Intrigued, Anubis challenges her to devise a feasible plan.
In order to comply with company policy, Alice is still required to use Anubis' balance scales. Balance scales have two pans, a left and a right. Alice can place any number of items in each pan, and once released, the scales will tip in the direction of the pan whose items have a greater total weight.
Alice can custom-order a special set of feathers from Ma'at. Each feather will have a known positive integer weight (in units), where Alice is free to specify the exact weight that she wants for each feather in her set.
Then, Anubis will test her. He will present to her a series of hearts, and she must precisely measure the weight of each heart using only the balance scales and her special set of feathers. The weight of each heart is guaranteed to be a positive integer when measured using the same units as Alice's feathers.
Ma'at will grant Alice at most $$$15$$$ feathers. Alice wants to maximize the number of units that these $$$15$$$ feathers can measure. Let's help her out!
First things first, we want to make sure you have a high-level idea of what this problem is all about, without getting buried in technical details. Observe the "dialogue" interaction between Alice and Anubis shown here (at url https://imgur.com/a/HAJSRxk). This interaction is also what is encoded in the Sample Interaction section.
As we saw, the interaction comes in two phases: the "requesting", then the "testing".
First, output a positive integer $$$n$$$, meaning that you request a set of $$$n$$$ feathers, indexed from $$$1$$$ to $$$n$$$. Then, output a line of $$$n$$$ space-separated positive integers $$$w_1, w_2, w_3, \dots, w_n$$$, corresponding to the desired weight that you want each feather to have.
Next, output a positive integer $$$M$$$, corresponding to the claim, "Using only these feathers, I can accurately determine the weight of any heart, so long as its weight is a positive integer not greater than $$$M$$$." Ultimately, the higher this $$$M$$$, the higher your score will be. You may output $$$M$$$ up to $$$10^8$$$.
Based on your chosen feathers, Anubis will now challenge your claim. The judge first outputs a positive integer $$$T$$$, meaning that $$$T$$$ test cases will follow. This $$$T$$$ will be at most $$$100$$$.
For each test case, the judge selects a heart with some positive integer weight. We will give this heart an index of $$$0$$$, and lets its weight be denoted by $$$w_0$$$.
To use the balance scales, output a line containing only the word WEIGH. Then, output these four pieces of information, describing which items you want to put in each pan.
Let $$$L$$$ and $$$R$$$ be the total weights of the items placed in the left and right pans, respectively. Formally, $$$$$$\begin{align*} L &= w_{l_1} + w_{l_2} + \dots + w_{l_{k_l}}, \\ R &= w_{r_1} + w_{r_2} + \dots + w_{r_{k_r}}. \end{align*} $$$$$$
The judge will give one of the following responses.
You may perform as many queries as you want, so long as all test cases are answered within the time limit.
When you are ready to report the weight of the heart, output a line containing only the word VERDICT, and then output one of the following:
If the judge ever sends a >:( verdict, it will immediately terminate, and will send no further responses. In such a case, your program should terminate too.
$$$$$$\begin{align*}
&\begin{array}{|l|} \hline \text{Constraints For All Subtasks} \\ \hline \text{If you receive a }\mathtt{:)}\text{ verdict on all test cases, then you will be awarded points based on how high your declared $M$ was.} \\ \hline \end{array}\\
&\begin{array}{|c|c|l|} \hline \text{Subtask} & \text{Points} & \text{Constraints} \\ \hline 1 & \mathbf{30} & M \geq 15 \\ \hline 2 & \mathbf{5} & M \geq 25 \\ \hline 3 & \mathbf{10} & M \geq 70 \\ \hline 4 & \mathbf{5} & M \geq 1000 \\ \hline 5 & \mathbf{20} & M \geq 32123 \\ \hline 6 & \mathbf{5} & M \geq 65456 \\ \hline 7 & \mathbf{15} & M \geq 7142857 \\ \hline 8 & \mathbf{10} & M \geq 14142135 \\ \hline \end{array}\\
\end{align*}$$$$$$
2
<
=
:)
>
:)6 1 1 2 3 5 8 15 WEIGH 3 1 3 6 2 0 5 WEIGH 2 4 5 2 0 2 VERDICT EXACT 7 WEIGH 1 0 6 1 2 3 4 5 6 VERDICT HEAVY
The blank lines are only used here to illustrate the interaction between the contestant and the judge. Do not actually print these extra lines in your program.
| Name |
|---|


