Graph Contest 1 P3 - Counting Cycles

View as PDF

Submit solution

Points: 10
Time limit: 1.0s
Memory limit: 16M

Problem types

Given a graph as an adjacency matrix, calculate the total number of distinct simple cycles.
Remember that A \to B \to C \to A is not the same as A \to C \to B \to A, and that A \to B \to A is the same as B \to A \to B.

Input Specification

N \le 10, the number of vertices.
The adjacency matrix - N rows of N numbers.
The first row represents the first vertex, and similarly the last row represents the last vertex.

Output Specification

The number of distinct simple cycles of any length.

Sample Input

3
0 1 0
0 0 1
1 0 0

Sample Output

1

Comments

There are no comments at the moment.