Werewolf
Time limit1sMemory limit256 MB
Count the role assignments with exactly W werewolves that satisfy all accusations and defenses, modulo 1000000007.
- Level
Medium7 of 10
- Topics
- Graph, Dynamic programming, Combinatorics
- Solved
- No attempts yet
Problem
Among robots, exactly are werewolves. Each statement is an accusation (A) or defense (D) with . Werewolves never accuse werewolves, and any robot defended by a werewolf is also a werewolf. Count valid role assignments modulo .
Input
The first line contains , , and . The next lines each contain A a b or D a b.
Output
Print the number of valid assignments modulo .