CF1774C.Ice and Fire

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

Little09 and his friends are playing a game. There are nn players, and the temperature value of the player ii is ii .

The types of environment are expressed as 00 or 11 . When two players fight in a specific environment, if its type is 00 , the player with a lower temperature value in this environment always wins; if it is 11 , the player with a higher temperature value in this environment always wins. The types of the n1n-1 environments form a binary string ss with a length of n1n-1 .

If there are xx players participating in the game, there will be a total of x1x-1 battles, and the types of the x1x-1 environments will be the first x1x-1 characters of ss . While there is more than one player left in the tournament, choose any two remaining players to fight. The player who loses will be eliminated from the tournament. The type of the environment of battle ii is sis_i .

For each xx from 22 to nn , answer the following question: if all players whose temperature value does not exceed xx participate in the game, how many players have a chance to win?

输入格式

Each test contains multiple test cases. The first line contains a single integer tt ( 1t1031\le t \le 10^3 ) — the number of test cases. The description of the test cases follows.

The first line of each test case contains a single integer nn ( 2n21052\leq n\leq 2\cdot 10^5 ) — the number of players.

The second line of each test case contains a binary string ss with a length n1n-1 .

It is guaranteed that the sum of nn over all test cases does not exceed 31053\cdot 10^5 .

输出格式

For each test case output n1n-1 integers — for each xx from 22 to nn , output the number of players that have a chance to win.

输入输出样例

  • 输入#1

    2
    4
    001
    4
    101

    输出#1

    1 1 3 
    1 2 3

说明/提示

In the first test case, for x=2x=2 and x=3x=3 , only the player whose temperature value is 11 can be the winner. For x=4x=4 , the player whose temperature value is 2,3,42,3,4 can be the winner.

首页