CF1779E.Anya's Simultaneous Exhibition

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

This is an interactive problem.

Anya has gathered nn chess experts numbered from 11 to nn for which the following properties hold:

  • For any pair of players one of the players wins every game against the other (and no draws ever occur);
  • Transitivity does not necessarily hold — it might happen that AA always beats BB , BB always beats CC and CC always beats AA .

Anya does not know, for each pair, who is the player who beats the other.To organize a tournament, Anya hosts n1n-1 games. In each game, she chooses two players. One of them wins and stays, while the other one is disqualified. After all the games are hosted only one player will remain. A player is said to be a candidate master if they can win a tournament (notice that the winner of a tournament may depend on the players selected by Anya in the n1n-1 games).

Since Anya is a curious girl, she is interested in finding the candidate masters. Unfortunately, she does not have much time. To speed up the process, she will organize up to 2n2n simuls (short for "simultaneous exhibition", in which one player plays against many).

In one simul, Anya chooses exactly one player who will play against some (at least one) of the other players. The chosen player wins all games they would win in a regular game, and the same holds for losses. After the simul finishes, Anya is only told the total number of games won by the chosen player (but not which ones). Nobody is disqualified during a simul.

Can you help Anya host simuls and determine the candidate masters?

The winning players in each pair could be changed between the simuls, but only in a way that preserves the results of all previous simuls. These changes may depend on your queries.

输入格式

输出格式

Firstly, the jury sends one integer nn ( 3n2503 \leq n \leq 250 ) which should be read — the number of players. After that, your program may ask queries or report an answer.

To ask a query, print "? i  s1s2sni \; s_1 s_2 \ldots s_n " (without quotes), where ii is the index of the player who will play against some of the other players in the simul. ss is a binary string that denotes the players they play against. ii plays against every player jj for which sj=1s_j = 1 holds (and sj=1s_j = 1 should hold for at least one 1jn1 \leq j \leq n ). Please note that si=0s_i = 0 must hold since a player cannot play against themselves, otherwise, the query is considered to be incorrect.

After this, you should read an integer — the number of games player ii has won.

When you have identified the answer, you must print "! c1c2cnc_1 c_2 \ldots c_n " (without quotes) and terminate your program. cc is a binary string which represents the candidate masters. Player ii is a candidate master if ci=1c_i=1 holds, otherwise, they are not.

If you ask more than 2n2n queries or if one of the queries is malformed, the interaction terminates immediately and your program receives verdict Wrong Answer.

After printing a query do not forget to output the end of line and flush the output. Otherwise, you will get Idleness limit exceeded. To do this, use:

  • fflush(stdout) or cout.flush() in C++;
  • System.out.flush() in Java;
  • flush(output) in Pascal;
  • stdout.flush() in Python;
  • see the documentation for other languages.

Hacks are disabled in this problem.

输入输出样例

  • 输入#1

    3
    
    1
    
    1
    
    1

    输出#1

    ? 1 010
    
    ? 2 001
    
    ? 3 100
    
    ! 111
  • 输入#2

    5
    
    0
    
    3
    
    4

    输出#2

    ? 5 10110
    
    ? 2 10111
    
    ? 1 01111
    
    ! 10000

说明/提示

In the first example, the first query describes a simul in which player 11 plays against player 22 (and no one else). The answer to the query is 11 , meaning that player 11 won the only game they played. We can conclude that 11 beats 22 . Similarly, the second query tells us that 22 beats 33 and the third query tells us that 33 beats 11 . All players are candidate masters in this case as

  • Player 11 can win the tournament if 22 and 33 play first. 33 loses and leaves, while 22 stays. 11 then plays against 22 and wins;
  • Other players can win in the same fashion.

In the second example, the third query describes a simul in which player 11 plays against every other player. The answer to the query is 44 , meaning that they won every game they played. It can be concluded that player 11 also beats every other player. They can never lose, hence they are the only player who can remain at the end of every possible tournament, and the only possible candidate master.

首页