Computer Science Canada

#5 on DWITE

Author:  A.J [ Wed Oct 21, 2009 5:21 pm ]
Post subject:  #5 on DWITE

THe question stated that "We know that one (and only one) cycle exists, and we want to find its length.", but the 2nd and the 3rd testcases had 2 cycles on them...

My program solved everything excpet for those 2 particular testcases, assuming that there were only one cycle...only

Author:  Tony [ Wed Oct 21, 2009 5:39 pm ]
Post subject:  RE:#5 on DWITE

Quote:

2
1 2
2 2
5
1 2
1 3
3 2
1 4
4 1

2nd case -- the cycle is 2 -> 2 -> 2

3rd case -- the cycle is 1 -> 4 -> 1

Author:  Dan [ Wed Oct 21, 2009 5:43 pm ]
Post subject:  RE:#5 on DWITE

The edges are directional so well there may be mutipal cycles if you ignore the direction between the nodes there should only be one if you consider wich way the edge is going.

For example in 2nd case (that was used not in the sample) node 2 is a dead end and does not form a loop with the other nodes.

Author:  Analysis Mode [ Wed Oct 21, 2009 10:53 pm ]
Post subject:  RE:#5 on DWITE

The answer in this case:

2
1 2
2 2

is 1 right?

Author:  Tony [ Wed Oct 21, 2009 11:23 pm ]
Post subject:  Re: RE:#5 on DWITE

Analysis Mode @ Wed Oct 21, 2009 10:53 pm wrote:
The answer in this case:

2
1 2
2 2

is 1 right?

yes.


: