#JP28. 说谎者
说谎者
Problem Description
students stand in a line to play a game.
The -th student from the left says: there are liars to his left (excluding themselves).
Each student is either honest or a liar.
No two liars stand next to each other.
Honest students always tell the truth, while liars can tell either the truth or lies, so their statements are considered unreliable.
You need to determine the number of distinct possible game configurations, modulo .
Two configurations are considered different if at least one student is honest in one configuration and a liar in the other.
Input Format
Read the data from lie.in
.
The first line contains two integers and , where is as described in the problem, and is the subtask ID.
The next line contains integers, describing the array .
Output Format
Output the answer to lie.out
.
Output an integer representing the number of distinct possible game configurations, modulo .
Samples
We will use to mark liars and to mark honest students.
3 4
0 1 2
1
The only possible configuration is .
5 4
0 0 1 1 2
3
The three possible configurations are: , , .
5 4
0 1 2 3 4
0
5 4
0 0 1 1 1
4
5 4
5 1 5 2 5
1
1 1
0
2
4 4
2 3 1 1
0
See the attached file.
See the attached file.
Subtasks and Constraints
For all data, it is guaranteed that .
Subtasks are used in this task.
Subtasks ID | Special Properties | Score | ||
---|---|---|---|---|
N/A | ||||
are randomly generated in | ||||
N/A | ||||
统计
相关
在下列比赛中: