3016. Blue Forehead

单点时限: 2.0 sec

内存限制: 256 MB

Here we play an interesting game.

Assume we have n perfect logicians who have infallible logic,some of their foreheads were painted blue and other red.

Ok, let's start the game.

It's sure that at least one of the logicians has forehead painted blue.They will go to a dark room. Every time we turned on

the lights, so that they could see each other.Once they've known that they have a blue forehead and when the light get

turned off again , he or she will leave the room. After that's kind of settled down, they'll turn the lights on again and people

will look at each other again. Then, they'll turn the lights off again and maybe someone will leave the room, and so forth

and so on.

Do you know which turn the ith logicians will leave (if he'll not leave print -1)?

输入格式

Input starts with an integer T, denoting the number of test cases.

In each test case, first an integer n (1<=n<=100) indicate the number of logicians.

Then n integers followed represent the color of the ith logician's forehead (0 represents blue and 1 represent red).

输出格式

N integers tell which turn the ith logicians will leave.

样例

Input
2
1
0
3
0 1 0
Output
1
2 -1 2

9 人解决,14 人已尝试。

10 份提交通过,共有 23 份提交。

6.2 EMB 奖励。

创建: 10 年,11 月前.

修改: 7 年,2 月前.

最后提交: 3 年,12 月前.

来源: N/A

题目标签