21096_OlympicAvenues

2022-5-16 18:18| 发布者: Hocassian| 查看: 41| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-3-89504834302900-Problem List-采集的数据-后羿采集器.html

Pro.ID

21096

Title

Olympic Avenues

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=21096

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 1000/500 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    In Athens 2004 Olympic Games there were many Olympic sites (Stadiums, Olympic Village, Press Center, Offices, etc.). For the athletes, officials and press people to move fast between Olympic sites, Athens created what were called "Olympic Avenues" where only Olympic buses could move. Each Olympic avenue connects two Olympic sites. Not all Olympic sites are connected directly by an Olympic avenue. Each Olympic avenue connects exactly two Olympic sites. A bus driver is traveling from one Olympic site to another and she wants to travel only on the Olympic Avenues. Given the information about the Olympic sites and avenues, you are to help her to find a shortest route between two Olympic sites using only Olympic avenues.

    输入

    Each input file is organized as follows. The first line contains one integer: the number of Olympic sites, N, 5 ≤ N ≤ 50. Line 2 contains two integers S and F: the numbers of the starting and the ending sites of the route. The next line contains one integer L: the number of Olympic avenues. The following L lines describe these Olympic avenues. Each of these lines contain three integers I, J, and D: the first two are the Olympic sites I and J that are connected by the avenue and the third integer D is the distance between I and J. This way, the input is organized in the following form:

    N
    S  F
    L
    I1  J1  D1
    I2  J2  D2
    . . .
    IL  JL  DL

    输出

    Description

    In Athens 2004 Olympic Games there were many Olympic sites (Stadiums, Olympic Village, Press Center, Offices, etc.). For the athletes, officials and press people to move fast between Olympic sites, Athens created what were called "Olympic Avenues" where only Olympic buses could move. Each Olympic avenue connects two Olympic sites. Not all Olympic sites are connected directly by an Olympic avenue. Each Olympic avenue connects exactly two Olympic sites. A bus driver is traveling from one Olympic site to another and she wants to travel only on the Olympic Avenues. Given the information about the Olympic sites and avenues, you are to help her to find a shortest route between two Olympic sites using only Olympic avenues.

    Input

    Each input file is organized as follows. The first line contains one integer: the number of Olympic sites, N, 5 ≤ N ≤ 50. Line 2 contains two integers S and F: the numbers of the starting and the ending sites of the route. The next line contains one integer L: the number of Olympic avenues. The following L lines describe these Olympic avenues. Each of these lines contain three integers I, J, and D: the first two are the Olympic sites I and J that are connected by the avenue and the third integer D is the distance between I and J. This way, the input is organized in the following form:

    N
    S  F
    L
    I1  J1  D1
    I2  J2  D2
    . . .
    IL  JL  DL

    Output

    The first line is to contain the text #FILE olympic I where integer I is the number of the respective input file. The second line is to contain one integer: the length of the shortest route from S to F. The third line is to contain a sequence of integers: the numbers of the Olympic sites visited on the shortest route, where S is the first integer in the sequence and F is the last integer in the sequence.

    Sample Input

    6
    1 4
    8
    1 2 12
    1 6 8
    1 3 20
    6 5 10
    5 4 7
    5 3 2
    3 4 6
    2 3 5

    Sample Output

    #FILE olympic 0
    23
    1 2 3 4

    Source

    样例输入

    6
    1 4
    8
    1 2 12
    1 6 8
    1 3 20
    6 5 10
    5 4 7
    5 3 2
    3 4 6
    2 3 5

    样例输出

    #FILE olympic 0
    23
    1 2 3 4

    提示

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部