157 - Route Finding

All about problems in Volume 1. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

paulhryu
New poster
Posts: 45
Joined: Sat Jan 26, 2002 2:00 am
Contact:

Test Case

Post by paulhryu »

Here is a test case:

5
A:ab=Bbcdefghijk
B:abc=Ajdef=Cb
C:ab
D:cd=Eg
E:fg=Bf
AaAk
AcAk
AbBb
BaDd
#

The correct output is:
9: Aab=Bbc=Ajk
8: Acdefghijk
3: Ab=Bb
8: Babcdef=Dd

Your program gives:
9: Aab=Bbc=Ajk
8: Acdefghijk
3: Ab=Bb
11: Babcdef=Eg=Dd

pokute
New poster
Posts: 4
Joined: Tue Jan 07, 2003 10:58 am
Location: KOREA

thanks..

Post by pokute »

Thanks.. I realize my mistake :D

El-idioto
New poster
Posts: 45
Joined: Mon Jul 14, 2003 9:42 pm
Location: Zoetermeer, The Netherlands

Post by El-idioto »

Paul:
Brilliant example... I had the exact same output as Pokute, and managed to fix my problem using the example.

Thanks a lot!!!


Pokute:
I noticed you use a LOT of memory... I implemented this problem by using linked lists. Although it was quite a bit more complex than using arrays, it will assure my application will still work for problems where the station's names are more complex (and more numerous).

Post Reply

Return to “Volume 1 (100-199)”