6927.One Bit Positions

Time Limit: 1s Memory Limit: 512MB

You are given a binary string of length $n$ . Your task is to calculate, for every $k$ between $1 \ldots n-1$ , the number of ways we can choose two positions $i$ and $j$ such that $i-j=k$ and there is a one-bit at both positions.

Input Format(From the terminal/stdin)

The only input line has a string that consists only of characters $0$ and $1$ .

  • $2 \le n \le 2 \cdot 10^5$

Output Format(To the terminal/stdout)

For every distance $k$ between $1\ldots n-1$ print the number of ways we can choose two such positions.

Sample Input

Copy
1001011010
          \n

Sample Output

Copy
1 2 3 0 2 1 0 1 0
 · · · · · · · · \n
Source: CSES, Advanced Techniques, 2112

Submit

请先 登录

© 2025 FAQs