Counting Cycles
Given a graph as .. an adjacency matrix, calculate the total number of distinct simple cycles.Remember that A - B - C - A is not the same as A - C - B - A, and that A - B - A is the same as B - A - B.
Input
.. Same as before.N ≤ 10.
Output
The number of distinct simple cycles of any length.Sample Input
3 0 1 0 0 0 1 1 0 0
Sample Output
1
All Submissions
Best Solutions
Point Value: 10
Time Limit: 2.00s
Memory Limit: 16M
Added: Jun 28, 2013
Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3
Comments (Search)
Test case #5: RE (signal 6: SIGABRT) [0.192s, 2888K] (0/10) (Details)
What kind of errors/bugs are related to a RE?
bad_alloc is thrown if, for example, you try to create a vector of 10 million ints. You don't have 40M of memory available to you, so it'll fail.
out_of_range can be thrown if you're trying to get an invalid substring, or if you use a range-checking accessor, like Vector::at().
(In your case, it's a bad_alloc.)