• 6.2.6 Here We Go(relians) Again & 6.2.7 Transit search


    Here We Go(relians) Again

    Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
    Total Submission(s): 130 Accepted Submission(s): 85

    Problem Description
    The Gorelians are a warlike race that travel the universe conquering new worlds as a form of recreation. Given their violent, fun-loving nature, keeping their leaders alive is of serious concern. Part of the Gorelian security plan involves changing the traffic patterns of their cities on a daily basis, and routing all Gorelian Government Officials to the Government Building by the fastest possible route.

    Fortunately for the Gorelian Minister of Traffic (that would be you), all Gorelian cities are laid out as a rectangular grid of blocks, where each block is a square measuring 2520 rels per side (a rel is the Gorelian Official Unit of Distance). The speed limit between two adjacent intersections is always constant, and may range from 1 to 9 rels per blip (a blip, of course, being the Gorelian Official Unit of Time). Since Gorelians have outlawed decimal numbers as unholy (hey, if you\\\\\\\'re the dominant force in the known universe, you can outlaw whatever you want), speed limits are always integer values. This explains why Gorelian blocks are precisely 2520 rels in length: 2520 is the least common multiple of the integers 1 through 9. Thus, the time required to travel between two adjacent intersections is always an integer number of blips.

    In all Gorelian cities, Government Housing is always at the northwest corner of the city, while the Government Building is always at the southeast corner. Streets between intersections might be one-way or two-way, or possibly even closed for repair (all this tinkering with traffic patterns causes a lot of accidents). Your job, given the details of speed limits, street directions, and street closures for a Gorelian city, is to determine the fastest route from Government Housing to the Government Building. (It is possible, due to street directions and closures, that no route exists, in which case a Gorelian Official Temporary Holiday is declared, and the Gorelian Officials take the day off.)

    The picture above shows a Gorelian City marked with speed limits, one way streets, and one closed street. It is assumed that streets are always traveled at the exact posted speed limit, and that turning a corner takes zero time. Under these conditions, you should be able to determine that the fastest route from Government Housing to the Government Building in this city is 1715 blips. And if the next day, the only change is that the closed road is opened to two way traffic at 9 rels per blip, the fastest route becomes 1295 blips. On the other hand, suppose the three one-way streets are switched from southbound to northbound (with the closed road remaining closed). In that case, no route would be possible and the day would be declared a holiday.
     

    Input
    The input consists of a set of cities for which you must find a fastest route if one exists. The first line of an input case contains two integers, which are the vertical and horizontal number of city blocks, respectively. The smallest city is a single block, or 1 by 1, and the largest city is 20 by 20 blocks. The remainder of the input specifies speed limits and traffic directions for streets between intersections, one row of street segments at a time. The first line of the input (after the dimensions line) contains the data for the northernmost east-west street segments. The next line contains the data for the northernmost row of north-south street segments. Then the next row of east-west streets, then north-south streets, and so on, until the southernmost row of east-west streets. Speed limits and directions of travel are specified in order from west to east, and each consists of an integer from 0 to 9 indicating speed limit, and a symbol indicating which direction traffic may flow. A zero speed limit means the road is closed. All digits and symbols are delimited by a single space. For east-west streets, the symbol will be an asterisk \\\\\\\'*\\\\\\\' which indicates travel is allowed in both directions, a less-than symbol \\\\\\\'<\\\\\\\' which indicates travel is allowed only in an east-to-west direction, or a greater-than symbol \\\\\\\'>\\\\\\\' which indicates travel is allowed only in a west-to-east direction. For north-south streets, an asterisk again indicates travel is allowed in either direction, a lowercase \\\\\\\"vee\\\\\\\" character \\\\\\\'v\\\\\\\' indicates travel is allowed only in a north-to-south directions, and a caret symbol \\\\\\\'^\\\\\\\' indicates travel is allowed only in a south-to-north direction. A zero speed, indicating a closed road, is always followed by an asterisk. Input cities continue in this manner until a value of zero is specified for both the vertical and horizontal dimensions.
     

    Output

                For each input scenario, output a line specifying the integer number of blips of the shortest route, a space, and then the word \\\\\\\"blips\\\\\\\". For scenarios which have no route, output a line with the word \\\\\\\"Holiday\\\\\\\".
     

    Sample Input
    2 2
    9 * 9 *
    6 v 0 * 8 v
    3 * 7 *
    3 * 6 v 3 *
    4 * 8 *
    2 2
    9 * 9 *
    6 v 9 * 8 v
    3 * 7 *
    3 * 6 v 3 *
    4 * 8 *
    2 2
    9 * 9 *
    6 ^ 0 * 8 ^
    3 * 7 *
    3 * 6 ^ 3 *
    4 * 8 *
    0 0
     

    Sample Output
    1715 blips
    1295 blips
    Holiday

    思路:恶心题,不想做
    http://www.2cto.com/kf/201210/161859.html

    Transit search

    Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
    Total Submission(s): 42 Accepted Submission(s): 21

    Problem Description
    Henry decides to develop a web site, which will provide the service of transit search. But he can only get the transit data of Guangzhou, so his web site can only support the transit search of Guangzhou. We suppose Guangzhou is 10240 meters by 10240 meters. The coordinate of the top-left corner is (0,0). The coordinate of the bottom-right corner is (10240,10240). The X–axis is from top to bottom and the Y-axis is from left to right. At the beginning, four pictures of the size 10cm by 10 cm make up of the whole map of Guangzhou. They are numbered from 0 to 3. It is to say at the beginning the scale of the map is 1cm:512 meters. We call the four pictures are at level 1.

    When you double-click on the map using the mouse, the map will zoom in. The pictures at next level will be shown on the screen. For example, when you double-click on the above map, picture 0 will be replaced by four pictures 00, 01, 02, 03, all of whose sizes are 10 cm by 10 cm. and the scale of the map change to 1cm:256 meters. (notice that, pictures 00,01,02,03 together describe the same area as picture 0). When you continue double-click, picture 01 will be replaced by pictures 010,011,012,013, and so on.
    Now, a position’s coordinate can be given by(str, x,y). str consists of 8 characters each from 0 to 3. It describes the id of the picture which the position is located at. x and y(0cm<=x,y<=10cm) describe the position’s offset relative to the top-left corner on picture str. Notice that the X–axis is from top to bottom and the Y-axis is from left to right.

    Now, the start position and end position are given as (start, sx, sy), (end, ex, ey). And some information about the bus line will be also given. First, each bus stop will be described by (name, x, y), its name and its coordinate. Second, each bus line will be described by (name1, name2, name3…namek) which are the bus stops the bus line travels through. If the distance between the start position and end position is no more than 2000 meters, the web site will suggest walking there. Otherwise, the web site will find a bus stop whose distance is no more than 1000 meters from the start position. You can take buses to a bus stop whose distance is no more than 1000 meters from the end position. Along the way, you can change buses at any bus stop. If you can take buses according the above rules, the web site will find a route with fewest number of changing buses. If you can’t take buses according the above rules, the web site will suggest taking a taxi.

     

    Input
    The input begins with a line containing an integer T, the number of test cases.
    For each case, the first two lines describe the start position and the end position as followed.
    Start sx sy
    End ex ey
    Start and End both contain 8 characters each from 0 to 3. 0cm<=sx,sy,ex,ey<=10cm. Notice that all the numbers in the input are integers.
    The next line contains an integer n(0<n<5001), indicating the total number of bus stops in Guangzhou. The following n lines each describe a bus stop in the format:
    Name x y
    Name contains no more than 20 characters. 0<=x,y<=10240.
    Next comes an integer m(0<m<=100), indicating the number of bus lines in Guangzhou.
    Then following is the description of the m bus lines.
    Each bus line is described as followed:
    K
    Name1 Name2 Name3 … Namek
    K(0<K<=30) is the number of bus stops along the bus line.
    Namei is the ith bus stop along the bus line. Notice that the bus line is bidirectional.

     

    Output
    (1)  If the distance between the start position and end position is no more than 2000 meters, print “walk there” in a single line.
    (2)  If you can take buses according to the above rule, print the fewest number of buses you have to take. For example, if you can take a bus directly to end position without changing bus line, print 1.
    (3)  Otherwise, print “take a taxi” in a single line.

     

    Sample Input
    3
    00000000 1 1
    00001000 3 3
    4
    a 1 1
    b 20 30
    c 40 50
    d 100 100
    2
    3
    a b c
    3
    b c d
    00000000 1 1
    03231130 5 5
    5
    a 1 1
    b 1000 1000
    c 3000 3000
    d 3000 4000
    e 4500 4000
    2
    3
    a b c
    3
    c d e
    00000000 1 1
    03231130 5 5
    4
    a 1 1
    b 1000 1000
    c 3000 3000
    d 3000 4000
    2
    3
    a b c
    3
    b c d
     

    Sample Output
    walk there
    2
    take a taxi

    思路:恶心题,不想做

    http://blog.csdn.net/me4546/article/details/6585310

  • 相关阅读:
    BZOJ 1040 (ZJOI 2008) 骑士
    BZOJ 1037 (ZJOI 2008) 生日聚会
    ZJOI 2006 物流运输 bzoj1003
    ZJOI 2006 物流运输 bzoj1003
    NOI2001 炮兵阵地 洛谷2704
    NOI2001 炮兵阵地 洛谷2704
    JLOI 2013 卡牌游戏 bzoj3191
    JLOI 2013 卡牌游戏 bzoj3191
    Noip 2012 day2t1 同余方程
    bzoj 1191 [HNOI2006]超级英雄Hero——二分图匹配
  • 原文地址:https://www.cnblogs.com/cssystem/p/3048548.html
Copyright © 2020-2023  润新知