2 shunfurh shunfurh 于 2017.09.13 18:58 提问

Taxi Cab Scheme

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.

Sample Input

2
2
08:00 10 11 9 16
08:07 9 16 10 11
2
08:00 10 11 9 16
08:06 9 16 10 11
Sample Output

1
2

1个回答

caozhy
caozhy   Ds   Rxr 2017.09.29 23:55
已采纳
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!
其他相关推荐
poj2060——Taxi Cab Scheme(最小路径覆盖)
DescriptionRunning 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 poss
Taxi Cab Scheme
原题构图+简单路径覆盖#include #include #define MAXN 510using namespace std ;struct Ride{ int minutes , a , b , c , d , cost ;} ;struct Graph{ int v , next ;};Graph G[MAXN * MAXN] ;
【POJ2060】Taxi Cab Scheme
二分图 前向星
hdu 1350 Taxi Cab Scheme(二分匹配)
Taxi Cab Scheme Time Limit: 20000/10000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 943 Accepted Submission(s): 456 Problem Description Running a taxi station is not all that simple. Apart from the obvious deman
Taxi Cab Scheme———最小路径覆盖
Description 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
poj2060 Taxi Cab Scheme
这道题依然是一道裸的最短路径覆盖,注意建图。 建图:以每个任务为节点,若是从任务i能在规定的时间内到达任务j,则从i连一条边到j。 const MAXN=500; var tc,n:longint; a,as,ae:array[1..MAXN,1..2]of longint; g:array[1..MAXN,1..MAXN]of longint; match,t:array[1..MA
HDU1350 Taxi Cab Scheme
Taxi Cab Scheme Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 1126    Accepted Submission(s): 573 Problem Description Running a tax
POJ2060 Taxi Cab Scheme
注意一辆太可惜是从一个起点到达终点再从这个终点抵达下一个位置的起点,最小路径覆盖 #include #include using namespace std; const int size = 600; struct node { int
poj2060 - Taxi Cab Scheme
想看更多的解题报告: http://blog.csdn.net/wangjian8006/article/details/7870410                                   转载请注明出处:http://blog.csdn.net/wangjian8006 题目大意:有m个任务,每个任务有开始的时间(xx:xx),起点(a,b)与终点(c,d) 然后做完这
NOJ[1159] Taxi Cab Scheme
问题描述 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 possib