(beginer) 网络流(拆点+时序模型) UVA 1161 - Objective: Berlin
来源:互联网 发布:excel筛选出多个数据 编辑:程序博客网 时间:2024/06/05 20:03
Objective: Berlin
The administration of a well-known football team has made a study about the lack of support in international away games. This study has concluded that the only reason for this lack of support is the difficulty in organizing the travel arrangements. To help solving this problem, the administration has asked you to build a program that computes the maximum number of people that can fly from a departure city to a destination city, using the available places in regular flights in a given day, and arriving at or before a given time. When traveling from one city to another, a person may make multiple transfers. Each transfer is, at least, 30 minutes long, i.e., the departure time should be, at least 30 minutes after the arrival time. Given a set of flights for a single day and the latest arrival time, your program should compute the maximum number of persons that can fly, directly or indirectly, from a departure city to a destination city, arriving at or before the latest arrival time.
Input
The input will contain several test cases, each of them as described below. Consecutive test cases are separated by a single blank line.The first line contains an integer (smaller or equal to 150) indicating the number of cities that have flight connections. The second line contains a string indicating the city of departure. The third line contains a string indicating the destination city. The fourth line contains the latest arrival time, in the format HHMM, where HH is the hour in the day (from 00 to 23) and MM is the minute in the hour (from 00 to 59). The fifth line contains an integer N (smaller or equal to 5000), with the number of existing flights.
Each of the following N lines contains the info for each flight. Each such line contains two strings and three integers, separated by blank spaces, O E C D A, where O and E are, respectively, the origin and destination of a flight, C is the number of available places in the flight (from 0 to 300), and D and A are the departure and arrival times in the previously defined format HHMM. All flights start and end in the same day. City names may have up to 8 characters.
Output
For each test case, the output consists of one single line with an integer stating the maximum number of people that can fly from the origin to the destination city, using the given flights and arriving at or before the given latest arrival time.
Sample Input
4
lisbon
berlin
1500
9
lisbon london 6 1000 1100
london lisbon 6 1130 1230
lisbon paris 5 1000 1100
paris lisbon 4 1130 1230
london paris 1 1130 1300
london berlin 2 1340 1510
berlin london 2 1300 1430
paris berlin 10 1330 1500
berlin paris 9 1300 1430
Sample Output
6
- (beginer) 网络流(拆点+时序模型) UVA 1161 - Objective: Berlin
- UVA 1161&& UVALive 3645 Objective: Berlin (最大流 -- 时序模型)
- UVA - 1161 Objective: Berlin(最大流+时序模型)
- uva 1161 Objective: Berlin (最大流)
- UVA 1161 - Objective: Berlin(最大流)
- (beginer) 网络流(拆点) UVA 563 Crimewave
- UVA 1161 - Objective: Berlin(网络流)
- (beginer) 网络流(拆点)UVA 12125 - March of the Penguins
- Uva-1161-Objective: Berlin
- (beginer) 网络流(区间模型+最大费用流) UVA 1317 Concert Hall Scheduling
- Objective: Berlin - UVa 1161 Dinic
- UVALive 3645 Objective: Berlin(最大流)
- (intermediate) 网络流(时序模型+离散化) UVA 11167 - Monkeys in the Emei Mountain
- Uva 10983 Buy one, get the rest free(网络流/时序模型)
- (beginer) 网络流(最大流+二分) UVA 1345 - Jamie\'s Contact Groups
- (beginer)网络流(最小割最大流) UVA 1212 - Duopoly
- (beginer) 网络流(最小费用流+费用跟流量有关) UVA 1486 - Transportation
- UVALive 3645 Objective: Berlin (最大流,拆点法)
- (beginer) 二分图(最大独立集) UVA 12168 Cat vs. Dog
- (intermediate) 二分图(边着色) UVA 10615 Rooks
- (beginer) 最小费用最大流 UVA 10806 - Dijkstra, Dijkstra.
- (beginer) 网络流(最大流+二分) UVA 1345 - Jamie\'s Contact Groups
- 《将博客搬至CSDN》
- (beginer) 网络流(拆点+时序模型) UVA 1161 - Objective: Berlin
- (beginer) 网络流(拆点)UVA 12125 - March of the Penguins
- (beginer)网络流(最小割最大流) UVA 1212 - Duopoly
- (beginer) 网络流(区间模型+最大费用流) UVA 1317 Concert Hall Scheduling
- (beginer) 网络流(最小费用流+费用跟流量有关) UVA 1486 - Transportation
- (beginer) 网络流 UVA 10249 - The Grand Dinner
- OOC源码(二)
- C++中的引用
- CSS中不为人知Zoom属性的使用介绍(IE私有属性)