Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|

Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |

Language: Carpool
Description A group of friends has just completed their CS assignments, and because of the nice weather, they decide to go to Joe's house for a BBQ. Unfortunately, after all that coding, they are too tired to walk. Fortunately, between them they have enough cars to take everyone. Joe remembers that he needs to stop off at the supermarket along the way to buy some burgers and pop. Jenn proposes that they stop at her house to get a frisbee. Jim decides that he doesn't like burgers, and wants to grab a pizza along the way. After having spent so long in the computer lab, Jerry's eyes have become very sensitive to sunlight, so he needs to stop at his house for his sunglasses. And so it goes: each person needs to run a little errand along the way. At this rate, the friends worry that it will be dark by the time they get to Joe's house. They launch into a heated discussion to about who should go in which car to minimize the time needed for everyone to reach Joe's house. The discussion itself, of course, wastes precious time that could be better spent at the BBQ. To help the group, you will write a program to settle the discussion by computing an optimal assignment of people to cars. The overall travel time is the maximum of the travel times of each car. An optimal assignment is one that minimizes the overall travel time. Your program will be provided with a representation of the roads in the city, in the form of distances between major landmarks. Assume that every car always travels at 60 kilometres per hour (one kilometre per minute). Each stop (at a supermarket, someone's house, etc.) takes five minutes. Although the friends have many cars between them, to be nice to the environment, they decide to take no more cars than necessary. Each car can take at most five people. Input The first line of input contains two integers Output Output a single integer, giving the number of minutes required for everyone to reach Joe's house using an optimal assignment of people to cars. Sample Input 1 2 0 1 15 1 2 10 Sample Output 30 Source Waterloo Local Contest, 2007.9.23 |

[Submit] [Go Back] [Status] [Discuss]

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di

Any problem, Please Contact Administrator