#P4159. [SCOI2009] 迷路
[SCOI2009] 迷路
Description
The directed graph has nodes, numbered from to . windy starts from node and must arrive at node exactly at time .
Given the directed graph, can you tell windy how many different paths there are?
The answer is taken modulo .
Note: windy cannot wait at any node, and the time to traverse any directed edge is exactly the specified time.
Input Format
The first line contains two integers, and .
Lines to each contain a string of length . In line , the -th character is a digit. If it is , there is no edge from node to node ; otherwise, the length of the edge from node to node is .
Output Format
Output a single integer: the answer modulo .
2 2
11
00
1
5 30
12045
07105
47805
12024
12345
852
Hint
-
Explanation for Sample Input/Output 1
The path is . -
Constraints
- For of the testdata, , .
- For of the testdata, , .
Translated by ChatGPT 5
京公网安备 11011102002149号