#P15882. [ICPC 2026 NAC] Heist of the Century

    ID: 15805 远端评测题 4000ms 2048MiB 尝试: 0 已通过: 0 难度: (无) 上传者: 标签>交互题Special JudgeICPC2026NAC

[ICPC 2026 NAC] Heist of the Century

Description

After planning the most elaborate heist to steal The Crown Jewel of Count Monte Carlo, you have encountered the final obstacle in your path: a locked safe. However, you have trained for this very moment and honed your safecracking abilities.

The safe has NN dials, each of which can be set to any integer value from 11 to 2N2N. Count Monte Carlo has configured the safe with a correct, secret value for each dial. To attempt to open the safe, you set each dial to a value of your choice, and then turn the safe door handle. If every single dial is set to its correct secret value, you will feel no resistance and the door will swing open immediately.

Of course, opening the safe by randomly guessing all of the right secret values is highly unlikely to succeed. However, as an expert safecracker, even if your guess is wrong you feel some resistance when you attempt to open the door and you can use that knowledge to help decipher the correct secret values. If a dial has secret value hh and the dial is set to dd when you try to open the door, the dial will exert resistance hd|h-d| to turning the door handle. You can feel the maximum\emph{maximum} resistance over all of the dials. (Note that if this value is 00, you have successfully opened the safe and completed your heist!)

Unfortunately, the security team has been made aware of your presence and they are closing in on your location. You are able to make one attempt at opening the safe per second, but they are 4N4N seconds away! Can you complete the heist before you get caught?

Interaction

This is an interactive problem.

Interaction begins by reading an integer NN (1N500)(1 \leq N \leq 500) from standard input, the number of dials on the safe.

Your program may make up to 4N4N attempts to open the safe door by specifying a value to try for each safe dial. You will then be told the resistance you feel from the door handle after each attempt.

To make an attempt, print a line containing NN space-separated integers d1,d2,,dNd_1, d_2, \ldots, d_N (1di2N)(1 \leq d_i \leq 2N), the values you propose for each dial. Then read a single integer from standard input representing the resistance that you felt from the door handle, maxihidi\max_i |h_i - d_i|, where hih_i is the (unknown to you) secret value of dial ii. If the resistance is 00, you have opened the safe and your program should terminate. Otherwise, if you have attempts remaining, you may try again.

If you run out of attempts, your program should exit cleanly (though it will be judged incorrect for failing to crack the safe in time to escape the guards).

The secret value of each dial was configured by Count Monte Carlo in advance of the heist and will not change in response to your cracking attempts.

3

5

1

0

1 1 1

3 4 5

4 5 6

Hint

Notes

$\textbf{Do not forget to flush the output stream after each line that you print}$ and to cleanly exit after the interaction is done. Please also make sure that you follow the above interaction protocol exactly\textbf{exactly} regarding what information to print on which line of output: for example, if the protocol requires you to print a list of space-separated integers on a single line, the judge will not\textbf{will not} accept each integer on its own line.

If the judge receives invalid or unexpected input, it will print 1-1 and then immediately exit. Your program must detect this error report and cleanly exit in order to receive a Wrong Answer verdict. If your program blocks waiting for further interaction from the judge, or tries to interpret the 1-1 as a resistance value, you may receive a different rejected verdict (such as Time Limit Exceeded or Runtime Error) instead of Wrong Answer.

You have been provided with a command-line tool for local testing. The tool has comments at the top explaining its use.