시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 128 MB | 10 | 4 | 4 | 44.444% |
Given a set of distinct integers S and an integer G, we call a sequence of integers a G-Avoiding Sequence if the following two conditions hold:
Compute the number of G-Avoiding Sequences modulo the prime 1,234,567,891.
The input consists of several test cases. The first line of each test case contains two integers N (1 ≤ N ≤ 200), the size of S, and G (1 ≤ G ≤ 1,000). The next line will contain N integers, which are the elements of S and between 0 and 106. Input is followed by a single line with N = G = 0, which should not be processed.
For each test case, output a single line containing the number of G-Avoiding Sequences modulo the prime 1,234,567,891.
4 3 1 2 3 4 3 100 10 110 42 0 0
12 2