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

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

Binaria

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

요약
길이 N인 이진 문자열 중 길이 K인 윈도우 합들이 주어진 수열과 같은 것의 개수를 10^6+3으로 나눈 나머지를 구한다.
난이도

보통10점 중 6점

유형
동적 계획법, 슬라이딩 윈도우, 조합론
정답자
아직 제출이 없습니다

문제

You have been hired by the Cheap Communication Organization (CCO) to work on a communication breakthrough: sub-message sum (SMS). This revolutionary idea works as follows.

Given a binary string of length NN, and some positive integer KK with K≤NK \le N, the SMS for the string consists of a sequence of N−K+1N - K + 1 sums. The first sum in the sequence is the sum of digits 11 through KK, the second sum is the sum of digits 22 through K+1K + 1, and so on until the last sum which is the sum of digits N−K+1N - K + 1 through NN.

For example, if K=4K = 4, the SMS of the binary string 110010 is 2,2,12,2,1. This is because 1+1+0+0=2,1+0+0+1=2,1 + 1 + 0 + 0 = 2, 1 + 0 + 0 + 1 = 2, and 0+0+1+0=10 + 0 + 1 + 0 = 1.

Since you are a very junior developer, your job is not to find the original binary string from a given SMS, but rather the number of binary strings that could have formed this SMS.

입력

The first line of input contains the two space-separated integers NN and KK where 1≤K≤N1 \le K \le N. The second line of input contains N−K+1N - K + 1 space-separated integers which is the SMS of at least one binary string.

출력

Output the remainder of TT divided by the prime number 106+310^{6} + 3 where TT is the positive integer equal to the total number of possible binary strings that correspond to the given SMS.

제한

  • 1≤N≤1061 \le N \le 10^6

예제1

  1. 예제 1

    입력
    7 4
    3 2 2 2
    
    예상 출력
    3