아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Hamming

시간 제한25초메모리 제한1024 MB

요약
이진 문자열의 길이 k 부분수열 모든 쌍에 대해 해밍 거리의 합을 각 k마다 40961로 나눈 나머지를 구한다.
난이도

보통10점 중 7점

유형
조합론, 동적 계획법, 수학
정답자
아직 제출이 없습니다

문제

You are given a binary string ss of length nn. Compute the sum of pairwise Hamming distances between all subsequences of string ss with length exactly kk for all kk from 11 to nn. Since the answers can be very large, find them modulo 40,96140\\,961.

Hamming distance between two strings of equal length is the number of positions in which these two strings are different.

입력

The only line of input contains a string ss of length nn (1≤n≤8⋅1031 \le n \le 8 \cdot 10^{3}) containing only characters "0" and "1".

출력

Print nn numbers: kk-th of them must be the sum of pairwise Hamming distances between all subsequences of string ss with length exactly kk, taken modulo 40,96140\\,961.

예제2

  1. 예제 1

    입력
    11000110111001
    
    예상 출력
    48 4056 15326 31033 20654 29362 32472 13700 21357 12217 20411 12456 212 0
    
  2. 예제 2

    입력
    000
    
    예상 출력
    0 0 0