307307: CF1336D. Yui and Mahjong Set

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Yui and Mahjong Set

题意翻译

这是一道交互题。 有一个由 $n$ 个数构成的集合 $S$,内部元素可以重复。 保证,内部元素的值 $a_i$ 都满足 $1\le a_i\le n$,且对于一种值 $k$ 保证 $(\sum_{i\in S} [a_i=k])\le n$,即每种值在集合内不会出现超过 $n$ 次。 定义一个 $\mathbf {triplet}$ 为 $S$ 的一个大小为 $3$ 的子集,且这三个元素的值相同。 定义一个 $\mathbf{straight}$ 为 $S$ 的一个大小为 $3$ 的子集,且这三个元素的值连续,例如 $\{2,3,4\}$ 是一个 $\mathbf{straight}$,但是 $\{1,3,5\}$ 不是一个 $\mathbf{straight}$ 例如,对于集合 $\{1,2,2,1,3\}$ 中,其 $\mathbf{straight}$ 的数量为 $4$ 现在你可以进行至多 $n$ 次查询操作和 $1$ 次回答操作: - 查询操作:将一个数 $x(1\le x\le n)$ 插入集合 $S$,然后交互器会告诉你插入结束后集合 $S$ 中的 $\mathbf{triplet}$ 和 $\mathbf{straight}$ 的数量。 - 回答操作:令 $c_i$ 表示集合 $S$ 中权值为 $c_i$ 的数的个数,则你需要求出对于初始的集合 $S$,求出 $c_1,c_2\sim c_n$ - 交互器会告诉您 $n$ 以及初始时集合 $S$ 中的 $\mathbf{triplet}$ 和 $\mathbf{straight}$ 的数量。 执行查询操作的格式为 ```+ x```,执行回答操作的格式为 ```! c1 c2 c3 ... cn``` 数据范围:$4\le n\le 100$

题目描述

This is an interactive problem. Yui is a girl who enjoys playing Mahjong. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF1336D/ba021191f7d362712a9889299b0ae5ce432eaf4f.png)She has a mysterious set which consists of tiles (this set can be empty). Each tile has an integer value between $ 1 $ and $ n $ , and at most $ n $ tiles in the set have the same value. So the set can contain at most $ n^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\} $ is a triplet, but $ \{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\} $ is a straight, but $ \{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 $ 1 $ and $ n $ into the set at most $ n $ 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\} $ you can find $ 4 $ subsets $ \{1,\,2,\,3\} $ . Try to guess the number of tiles in the initial set with value $ i $ for all integers $ i $ from $ 1 $ to $ n $ .

输入输出格式

输入格式


The first line contains a single integer $ n $ ( $ 4 \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 "! $ a_1 $ $ a_2 $ $ \ldots $ $ a_n $ " ( $ 0 \le a_i \le n $ ), where $ a_i $ is equal to the number of tiles in the initial set with value $ i $ . Interaction To insert a tile, print a single line of form "+ $ x $ " ( $ 1 \le x \le n $ ), where $ x $ 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 $ n $ tiles. Hacks To make a hack you should provide a test in such format: The first line contains a single integer $ n $ ( $ 4 \le n \le 100 $ ). The second line contains $ n $ integers $ a_1,a_2,\ldots,a_n $ ( $ 0 \le a_i \le n $ ) — $ a_i $ is equal to the number of tiles with value $ i $ 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\} $ . It has only one triplet subset $ \{3, 3, 3\} $ and six straight subsets, all equal to $ \{1, 2, 3\} $ . After inserting a tile with value $ 1 $ the set of tiles will be $ \{1, 1, 1, 2, 3, 3, 3, 5, 5\} $ and will have two triplet subsets $ \{1, 1, 1\} $ , $ \{3, 3, 3\} $ and nine straight subsets, all equal to $ \{1, 2, 3\} $ .

Input

题意翻译

这是一道交互题。 有一个由 $n$ 个数构成的集合 $S$,内部元素可以重复。 保证,内部元素的值 $a_i$ 都满足 $1\le a_i\le n$,且对于一种值 $k$ 保证 $(\sum_{i\in S} [a_i=k])\le n$,即每种值在集合内不会出现超过 $n$ 次。 定义一个 $\mathbf {triplet}$ 为 $S$ 的一个大小为 $3$ 的子集,且这三个元素的值相同。 定义一个 $\mathbf{straight}$ 为 $S$ 的一个大小为 $3$ 的子集,且这三个元素的值连续,例如 $\{2,3,4\}$ 是一个 $\mathbf{straight}$,但是 $\{1,3,5\}$ 不是一个 $\mathbf{straight}$ 例如,对于集合 $\{1,2,2,1,3\}$ 中,其 $\mathbf{straight}$ 的数量为 $4$ 现在你可以进行至多 $n$ 次查询操作和 $1$ 次回答操作: - 查询操作:将一个数 $x(1\le x\le n)$ 插入集合 $S$,然后交互器会告诉你插入结束后集合 $S$ 中的 $\mathbf{triplet}$ 和 $\mathbf{straight}$ 的数量。 - 回答操作:令 $c_i$ 表示集合 $S$ 中权值为 $c_i$ 的数的个数,则你需要求出对于初始的集合 $S$,求出 $c_1,c_2\sim c_n$ - 交互器会告诉您 $n$ 以及初始时集合 $S$ 中的 $\mathbf{triplet}$ 和 $\mathbf{straight}$ 的数量。 执行查询操作的格式为 ```+ x```,执行回答操作的格式为 ```! c1 c2 c3 ... cn``` 数据范围:$4\le n\le 100$

加入题单

算法标签: