CF1336D.Yui and Mahjong Set
NOI/NOI+/CTSC
通过率:0%
时间限制:1.00s
内存限制:256MB
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 1 and n, and at most n tiles in the set have the same value. So the set can contain at most n2 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.
这是一个交互式问题。
Yui 是一位喜欢打麻将的女孩。

她拥有一副神秘的牌组(该牌组可以为空)。每张牌上标有一个介于 1 到 n 之间的整数,且相同数值的牌至多有 n 张。因此,该牌组中最多包含 n2 张牌。
你想弄清楚每张牌上的具体数值。但 Yui 性格腼腆,她更愿意和你玩一个猜数游戏。
我们称由三张牌组成的集合为刻子(triplet),当且仅当这三张牌的数值完全相同。例如,{2,2,2} 是一个刻子,而 {2,3,3} 不是。
我们称由三张牌组成的集合为顺子(straight),当且仅当这三张牌的数值构成连续的三个整数。例如,{2,3,4} 是一个顺子,而 {1,3,5} 不是。
初始时,Yui 会告诉你:在初始牌组中,刻子子集的个数与顺子子集的个数(分别给出)。
此后,你最多可向该牌组中插入 n 次牌;每次插入的牌的数值必须是 1 到 n 之间的整数。每次插入一张牌后,你将再次获知当前牌组中刻子子集的个数与顺子子集的个数(分别给出)。
注意:两张数值相同的牌被视为不同的牌。换言之,在牌组 {1,1,2,2,3} 中,你可以找到 4 个子集 {1,2,3}(即从两个 1 中选一个、两个 2 中选一个、一个 3 中选一个,共 2×2×1=4 种组合)。
请推断出:对每个整数 i(1≤i≤n),初始牌组中数值为 i 的牌各有多少张。
输入格式
The first line contains a single integer n (4≤n≤100).
The second line contains two integers which represent the number of triplet subsets and straight subsets of the initial set respectively.
第一行包含一个整数 n(4≤n≤100)。
第二行包含两个整数,分别表示初始集合中三元子集和顺子子集的数量。
输出格式
When you are ready to answer, print a single line of form "! a1 a2 … an" (0≤ai≤n), where ai is equal to the number of tiles in the initial set with value i.
当你准备好作答时,请输出一行形如 “! a1 a2 … an” 的答案(其中 0≤ai≤n),这里 ai 表示初始集合中数值为 i 的方块数量。
输入输出样例
输入#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.
在第一次测试中,初始的牌组为 {1,1,2,3,3,3,5,5}。它仅包含一个刻子子集 {3,3,3} 和六个顺子子集,全部为 {1,2,3}。插入一张数值为 1 的牌后,牌组变为 {1,1,1,2,3,3,3,5,5},此时包含两个刻子子集 {1,1,1}、{3,3,3} 和九个顺子子集,全部为 {1,2,3}。
输入解题思路,AI测评打分。不知道怎么写?