CF1398F.Controversial Rounds

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

Alice and Bob play a game. The game consists of several sets, and each set consists of several rounds. Each round is won either by Alice or by Bob, and the set ends when one of the players has won xx rounds in a row. For example, if Bob won five rounds in a row and x=2x = 2 , then two sets ends.

You know that Alice and Bob have already played nn rounds, and you know the results of some rounds. For each xx from 11 to nn , calculate the maximum possible number of sets that could have already finished if each set lasts until one of the players wins xx rounds in a row. It is possible that the last set is still not finished — in that case, you should not count it in the answer.

输入格式

The first line contains one integer nn ( 1n1061 \le n \le 10^6 ) — the number of rounds.

The second line contains one string ss of length nn — the descriptions of rounds. If the ii -th element of the string is 0, then Alice won the ii -th round; if it is 1, then Bob won the ii -th round, and if it is ?, then you don't know who won the ii -th round.

输出格式

In the only line print nn integers. The ii -th integer should be equal to the maximum possible number of sets that could have already finished if each set lasts until one of the players wins ii rounds in a row.

输入输出样例

  • 输入#1

    6
    11?000

    输出#1

    6 3 2 1 0 0
  • 输入#2

    5
    01?01

    输出#2

    5 1 0 0 0
  • 输入#3

    12
    ???1??????1?

    输出#3

    12 6 4 3 2 2 1 1 1 1 1 1

说明/提示

Let's consider the first test case:

  • if x=1x = 1 and s=110000s = 110000 or s=111000s = 111000 then there are six finished sets;
  • if x=2x = 2 and s=110000s = 110000 then there are three finished sets;
  • if x=3x = 3 and s=111000s = 111000 then there are two finished sets;
  • if x=4x = 4 and s=110000s = 110000 then there is one finished set;
  • if x=5x = 5 then there are no finished sets;
  • if x=6x = 6 then there are no finished sets.
首页