Running a taxi station is not all that simple. Apart from the obvious demand for a centralised coordination of the cabs in order to pick up the customers calling to get a cab as soon as possible,there is also a need to schedule all the taxi rides which have been booked in advance.Given a list of all booked taxi rides for the next day, you want to minimise the number of cabs needed to carry out all of the rides. For the sake of simplicity, we model a city as a rectangular grid. An address in the city is denoted by two integers: the street and avenue number. The time needed to get from the address a, b to c, d by taxi is |a - c| + |b - d| minutes. A cab may carry out a booked ride if it is its first ride of the day, or if it can get to the source address of the new ride from its latest,at least one minute before the new ride's scheduled departure. Note that some rides may end after midnight.
Input
On the first line of the input is a single positive integer N, telling the number of test scenarios to follow. Each scenario begins with a line containing an integer M, 0 < M < 500, being the number of booked taxi rides. The following M lines contain the rides. Each ride is described by a departure time on the format hh:mm (ranging from 00:00 to 23:59), two integers a b that are the coordinates of the source address and two integers c d that are the coordinates of the destination address. All coordinates are at least 0 and strictly smaller than 200. The booked rides in each scenario are sorted in order of increasing departure time.
Output
For each scenario, output one line containing the minimum number of cabs required to carry out all the booked taxi rides.
]]>POJ 1112 Team Them Up! 姹傝ˉ鍥撅紝榪為氬垎閲忥紝DPhttp://www.shnenglu.com/linyangfei/archive/2008/08/08/58295.html椋為椋為Thu, 07 Aug 2008 16:51:00 GMThttp://www.shnenglu.com/linyangfei/archive/2008/08/08/58295.htmlhttp://www.shnenglu.com/linyangfei/comments/58295.htmlhttp://www.shnenglu.com/linyangfei/archive/2008/08/08/58295.html#Feedback2http://www.shnenglu.com/linyangfei/comments/commentRss/58295.htmlhttp://www.shnenglu.com/linyangfei/services/trackbacks/58295.html闃呰鍏ㄦ枃
]]>POJ 2047http://www.shnenglu.com/linyangfei/archive/2008/08/02/57811.html椋為椋為Sat, 02 Aug 2008 03:18:00 GMThttp://www.shnenglu.com/linyangfei/archive/2008/08/02/57811.htmlhttp://www.shnenglu.com/linyangfei/comments/57811.htmlhttp://www.shnenglu.com/linyangfei/archive/2008/08/02/57811.html#Feedback0http://www.shnenglu.com/linyangfei/comments/commentRss/57811.htmlhttp://www.shnenglu.com/linyangfei/services/trackbacks/57811.htmlConcert Hall Scheduling
Time Limit: 1000MS
Memory Limit: 30000K
Total Submissions: 574
Accepted: 229
Description
You are appointed director of a famous concert hall, to save it from bankruptcy. The hall is very popular, and receives many requests to use its two fine rooms, but unfortunately the previous director was not very efficient, and it has been losing money for many years. The two rooms are of the same size and arrangement. Therefore, each applicant wishing to hold a concert asks for a room without specifying which. Each room can be used for only one concert per day. In order to make more money, you have decided to abandon the previous fixed price policy, and rather let applicants specify the price they are ready to pay. Each application shall specify a period [i, j] and an asking price w, where i and j are respectively the first and last days of the period (1 <= i <= j <= 365), and w is a positive integer in yen, indicating the amount the applicant is willing to pay to use a room for the whole period.
You have received applications for the next year, and you should now choose the applications you will accept. Each application should be either accepted for its whole period or completely rejected. Each concert should use the same room during the whole applied period.
Considering the dire economic situation of the concert hall, artistic quality is to be ignored, and you should just try to maximize the total income for the whole year by accepting the most profitable applications.
Input
The input has multiple data sets, each starting with a line consisting of a single integer n, the number of applications in the data set. Then, it is followed by n lines, each of which represents one application with a period [i, j] and an asking price w yen in the following format.
i j w
A line containing a single zero indicates the end of the input.
The maximum number of applications in a data set is one thousand, and the maximum asking price is one million yen.
Output
For each data set, print a single line containing an integer, the maximum total income in yen for the data set.
]]>POJ 2335 嫻偣鏁扮殑gcdhttp://www.shnenglu.com/linyangfei/archive/2008/06/28/54874.html椋為椋為Sat, 28 Jun 2008 07:18:00 GMThttp://www.shnenglu.com/linyangfei/archive/2008/06/28/54874.htmlhttp://www.shnenglu.com/linyangfei/comments/54874.htmlhttp://www.shnenglu.com/linyangfei/archive/2008/06/28/54874.html#Feedback3http://www.shnenglu.com/linyangfei/comments/commentRss/54874.htmlhttp://www.shnenglu.com/linyangfei/services/trackbacks/54874.htmlTemple of Dune
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 211
Accepted: 82
Description
The Archaeologists of the Current Millenium (ACM) now and then discover ancient artifacts located at the vertices of regular polygons. In general it is necessary to move one sand dune to uncover each artifact. After discovering three artifacts, the archaeologists wish to compute the minimum number of dunes that must be moved to uncover all of them.
Input
The first line of input contains a positive integer n, the number of test cases. Each test case consists of three pairs of real numbers giving the x and y coordinates of three vertices from a regular polygon.
Output
For each line of input, output a single integer stating the fewest vertices that such a polygon might have. You may assume that each input case gives three distinct vertices of a regular polygon with at most 200 vertices.
]]>Written to alpcs in Normalhttp://www.shnenglu.com/linyangfei/archive/2008/06/18/53935.html椋為椋為Wed, 18 Jun 2008 14:50:00 GMThttp://www.shnenglu.com/linyangfei/archive/2008/06/18/53935.htmlhttp://www.shnenglu.com/linyangfei/comments/53935.htmlhttp://www.shnenglu.com/linyangfei/archive/2008/06/18/53935.html#Feedback3http://www.shnenglu.com/linyangfei/comments/commentRss/53935.htmlhttp://www.shnenglu.com/linyangfei/services/trackbacks/53935.htmlLast night alpc40 received a message and he told me sadly that two alpcs are eliminated from Normal, and he wasn’t willing to face up to the cruel reality. Actually the competition in alpcs also in ICPCis so fierce that every ACMers must do their best to improve themselves and to fight in every contest. Although it is so hard, I think that is why this contest attracts so many excellent programmers to join in the contest. I am sorry to hear that someone of you will lose your chances after these contests, but I want to remind you that every one no matter in Seed or Normal makes great effort. And you must realize that you are not as powerful as that Big Cows now. Someone who loses your chance does not mean that you lose all your chances in ICPC . If you really love it and want to do it, I think you mustn’t give it up. Because most of you are Sophomore or even freshmen, you still have many chances if and only if you work harder and learn more. ICPC is open to every body, and hope all of you will enjoy this game.