Editing
2015 Jan Bronze Problem 4 Meeting Time
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Solution == We solve this problem by calculating the shortest times from each pasture to the meeting pasture for both Bessie and Elsie. Then, for each pair of starting pastures, we calculate the meeting time by taking the maximum of the two times, and we keep track of the minimum meeting time across all pairs of starting pastures. For calculating the shortest times, we can use the Floyd-Warshall algorithm. The Floyd-Warshall algorithm works by repeatedly iterating over all pairs of nodes and attempting to improve the shortest path between them by including a third node. Finally, after we have calculated the shortest times for both Bessie and Elsie, we iterate over all pairs of starting pastures and calculate the meeting time. The meeting time is simply the maximum of the two times, since they leave simultaneously and the meeting cannot start until both have arrived. We keep track of the minimum meeting time across all pairs of starting pastures, and this is our answer.
Summary:
Please note that all contributions to Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
My wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information