Woburn Team Practice '07
We all know of the centuries-long battle between the monkeys and the
cows. In an attempt to defeat the cows once and for all, the monkeys are
holding a meeting to discuss battle strategy. The land in which the
monkeys live consists of
It is the day of the meeting, and all the monkeys are mingling with each
other. To their amazement, they discover that each of the monkeys
traveled from town
Input Specification
The first line of the input file contains a single integer
Each test case begins with a single line containing the integer 0
or 1
,
giving the one-way connections between towns in the land (0
means no
connection exists, 1
means a connection does exist).
Output Specification
A single integer that is the number of monkeys at the meeting. This
number should be outputted modulo
Sample Input
1
5
0 1 1 0 0
1 0 0 0 1
0 1 0 1 1
1 1 1 0 1
1 0 0 0 0
Sample Output
5
Explanation
There are
There cannot be any more monkeys at the meeting because the paths they
travelled wouldn't be distinct or would visit a town more than once
during their trip.
Comments
Since the original data were weak, an additional test case was added, and all submissions were rejudged.