CF1336D.Yui and Mahjong Set

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

This is an interactive problem.

Yui is a girl who enjoys playing Mahjong.

She has a mysterious set which consists of tiles (this set can be empty). Each tile has an integer value between 11 and nn , and at most nn tiles in the set have the same value. So the set can contain at most n2n^2 tiles.

You want to figure out which values are on the tiles. But Yui is shy, she prefers to play a guessing game with you.

Let's call a set consisting of three tiles triplet if their values are the same. For example, {2,2,2}\{2,\,2,\,2\} is a triplet, but {2,3,3}\{2,\,3,\,3\} is not.

Let's call a set consisting of three tiles straight if their values are consecutive integers. For example, {2,3,4}\{2,\,3,\,4\} is a straight, but {1,3,5}\{1,\,3,\,5\} is not.

At first, Yui gives you the number of triplet subsets and straight subsets of the initial set respectively. After that, you can insert a tile with an integer value between 11 and nn into the set at most nn times. Every time you insert a tile, you will get the number of triplet subsets and straight subsets of the current set as well.

Note that two tiles with the same value are treated different. In other words, in the set {1,1,2,2,3}\{1,\,1,\,2,\,2,\,3\} you can find 44 subsets {1,2,3}\{1,\,2,\,3\} .

Try to guess the number of tiles in the initial set with value ii for all integers ii from 11 to nn .

输入格式

The first line contains a single integer nn ( 4n1004 \le n \le 100 ).

The second line contains two integers which represent the number of triplet subsets and straight subsets of the initial set respectively.

输出格式

When you are ready to answer, print a single line of form "! a1a_1 a2a_2 \ldots ana_n " ( 0ain0 \le a_i \le n ), where aia_i is equal to the number of tiles in the initial set with value ii .

Interaction

To insert a tile, print a single line of form "+ xx " ( 1xn1 \le x \le n ), where xx is the value of the tile you insert. Then you should read two integers which represent the number of triplet subsets and straight subsets of the current set respectively.

After printing a line, do not forget to 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 documentation for other languages.

You will get Wrong answer if you insert more than nn tiles.

Hacks

To make a hack you should provide a test in such format:

The first line contains a single integer nn ( 4n1004 \le n \le 100 ).

The second line contains nn integers a1,a2,,ana_1,a_2,\ldots,a_n ( 0ain0 \le a_i \le n ) — aia_i is equal to the number of tiles with value ii in the set.

输入输出样例

  • 输入#1

    5
    1 6
    2 9
    5 12
    5 24
    6 24

    输出#1

    + 1
    + 1
    + 2
    + 5
    ! 2 1 3 0 2

说明/提示

In the first test, the initial set of tiles is {1,1,2,3,3,3,5,5}\{1, 1, 2, 3, 3, 3, 5, 5\} . It has only one triplet subset {3,3,3}\{3, 3, 3\} and six straight subsets, all equal to {1,2,3}\{1, 2, 3\} . After inserting a tile with value 11 the set of tiles will be {1,1,1,2,3,3,3,5,5}\{1, 1, 1, 2, 3, 3, 3, 5, 5\} and will have two triplet subsets {1,1,1}\{1, 1, 1\} , {3,3,3}\{3, 3, 3\} and nine straight subsets, all equal to {1,2,3}\{1, 2, 3\} .

首页