Hello guys ,

I have solved ZIO 2005 , P2 by brute force and it took me a lot of time . Any of you have a better solution for this problem ?

Thanks a lot !!

Hello guys ,

I have solved ZIO 2005 , P2 by brute force and it took me a lot of time . Any of you have a better solution for this problem ?

Thanks a lot !!

2 Likes

It is brute force. Another thing you can apply in this though is that if a bus stop is connected only from a single number

Like suppose

1â€” 4 â€” 8 â€” 9

4 â€” 7 â€” 2 â€” 3

.

.

.

Then 9 can never be the managerâ€™s office. Coz, the routes from 8 to any other number(except 9) will be shorter than 9. I eliminated them like that, and I could do it in 20-30 minutes.(All the 3 sub-parts)

2 Likes

hello @sudheerays123,

Yes, there exists a better way in which we can easily solve the problemâ€¦

See the attached photoâ€¦

First, create a graph of given data like in the image belowâ€¦

Then just compare the longest distance traveled to reach the Farthest point by some of the middle terms â€¦,like, i just compared 2,1,6 and 8 and 6 comes out to be the answer.!

Hope you understoodâ€¦

74614852_418258049087507_4146499321778405376_n|375x500

2 Likes

Yes, you can also make a graph as @sumit_king told you to do, but that will lead to the same thing which I explained you. It just clears our doubts further and there is a less chance of making a silly mistake, but it will take 10 minutes or so extra

1 Like

@aryan12 I have added problems which i couldnt solve in discussion

Can you pls help me if you have solved any of those problems

Here is the link : ZIO problems

Thanks a lot !

2 Likes