problems - Universidad Catlica Boliviana o Training Session...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Universidad Cat´ olica Boliviana Training Session 5, July 21, 2009 Problem A. Shipping Routes ID 383 Judge UVa The Slow Boat to China Shipping company needs a program to help them quickly quote costs to prospective customers. The cost of a shipment depends on the size of the shipment and on how many shipping legs it requires. A shipping leg connects two warehouses, but since every pair of warehouses is not directly connected by a leg, it might require more than one leg to send a shipment from one warehouse to another. A data set can represent from 1 to 30 warehouses. A two-letter code name will identify each warehouse (capital letters only). Shipping legs can exist between any two distinct warehouses. All legs are bidirectional. The cost of a shipment is equal to the size of the shipment times the number of shipping legs required times $ 100 . The input to the program identifies the warehouse code names and the existence of all shipping legs. For a given shipping request, consisting of the size of the shipment, the source warehouse and the destination warehouse, the program will output the best (cheapest) cost for the ship- ment, if it is possible to send shipments from the requested source to the requested destination. Alternately, the program must state that the request cannot be fulfilled. Input The first line will contain an integer from 1 to 10 inclusive that represents the number of data sets in the input file. Each data set represents a new shipping configuration. The first line of data in a data set will contain three integers, say M , N , and P : M is an integer from 1 to 30 inclusive representing the number of warehouses in the data set; N is an integer from 0 to M * ( M - 1) / 2 inclusive that represents the number of legs between warehouses in the data set; P is an integer from 0 to 10 inclusive that represents the number of shipping requests for which cost information is required. The second line of data in a data set contains M two-letter code names for the M warehouses of the data sets. Only capital letters are used. A single blank separates code names. N lines follow the line of code names, containing shipping leg information in the format: XXY Y ", with XX and Y Y being the codes for two distinct warehouses in the set that have a direct link (a shipping leg) between them. There will be a single blank between the warehouse codes. The N lines of shipping leg information are followed by P lines of shipping requests, one request per line. Each shipping request will begin with an integer between 1 and 20 inclusive that represents the size of the shipment. The shipment size will be followed by a pair of code names in the format “ AABB ", with AA and BB being the code for two distinct warehouses in the set which represent the source and destination of the requested shipment. The input will be valid and consistent. A shipping leg will only be represented once within a
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/06/2010 for the course FCEI ITPC taught by Professor Hernanpayrumani during the Fall '10 term at Universidad Católica Boliviana.

Page1 / 4

problems - Universidad Catlica Boliviana o Training Session...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online