Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 #5 on DWITE
Index -> CompSci.ca, Contests -> DWITE
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
A.J




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: 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
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Dan




PostPosted: 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.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Analysis Mode




PostPosted: 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?
Tony




PostPosted: 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> CompSci.ca, Contests -> DWITE
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: