22785_Counterattack

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

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

Pro.ID

22785

Title

Counterattack

Title链接

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

AC

0

Submit

0

Ratio

-

时间&空间限制

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

    Atour soccer training camp, we have rehearsed a lot of motion sequences. In case we are defending, all players except the two strikers of our team are in our half. As soon as we are getting the ball, we are starting a counterattack with a long-range pass to one of our strikers. They know each others motions equences and may pass the ball to the other striker at fixed points.

    Thereare a lot of decisions: the defender has to select the striker to pass the ball to, and the ball possessing striker has to decide at each of the n fixed points if to pass to the other striker or to run and to dribble. At the last position in the motion sequence of a striker he shoots on the goal. Each of the four actions (long-range pass, dribble, pass, and shoot on the goal) may fail (e.g.because of a defending player of the opposite team) -- so our coach has assigned difficulties.

    What's the minimal difficulty of a goal assuming your team plays optimally?

    The defending player (cross in left half) passes the ball to one of the strikers (crosses in right half). The strikers move along fixed paths simultaneously. At each of the fixed positions (circles), the ball possessing striker either dribbles with the ball or passes to the other striker. At the last position, he shoots on the goal.

    Thedefending player (cross in left half) passes the ball to one of the strikers(crosses in right half). The strikers move along fixed paths simultaneously. Ateach of the fixed positions (circles), the ball possessing striker eitherdribbles with the ball or passes to the other striker. At the last position, heshoots on the goal.

    输入

    The first line of the input consists of the number of test cases c that follow (1 ≤ c ≤ 100). Each test case consists of five lines. The first line of each test case contains n (2 ≤ n ≤ 100000), the number of fixed points in each strikers motion sequence. It is followed by l0, l1, s0 and s1, the difficulty of a long-range pass to the corresponding striker and the difficulties of the shoots of the strikers. Each striker is described in two lines (first striker 0, then striker 1): The first line contains n-1 difficulties, where the i-th number stands for passing from point i to the other player at point i + 1. The second line also contains n - 1 difficulties, where the i-th number stands for dribbling from point i to point i + 1. You may safely assume that each difficulty is a non-negative integer less than 1000.

    输出

    Description

    Atour soccer training camp, we have rehearsed a lot of motion sequences. In case we are defending, all players except the two strikers of our team are in our half. As soon as we are getting the ball, we are starting a counterattack with a long-range pass to one of our strikers. They know each others motions equences and may pass the ball to the other striker at fixed points.

    Thereare a lot of decisions: the defender has to select the striker to pass the ball to, and the ball possessing striker has to decide at each of the n fixed points if to pass to the other striker or to run and to dribble. At the last position in the motion sequence of a striker he shoots on the goal. Each of the four actions (long-range pass, dribble, pass, and shoot on the goal) may fail (e.g.because of a defending player of the opposite team) -- so our coach has assigned difficulties.

    What's the minimal difficulty of a goal assuming your team plays optimally?

    The defending player (cross in left half) passes the ball to one of the strikers (crosses in right half). The strikers move along fixed paths simultaneously. At each of the fixed positions (circles), the ball possessing striker either dribbles with the ball or passes to the other striker. At the last position, he shoots on the goal.

    Thedefending player (cross in left half) passes the ball to one of the strikers(crosses in right half). The strikers move along fixed paths simultaneously. Ateach of the fixed positions (circles), the ball possessing striker eitherdribbles with the ball or passes to the other striker. At the last position, heshoots on the goal.

    Input

    The first line of the input consists of the number of test cases c that follow (1 ≤ c ≤ 100). Each test case consists of five lines. The first line of each test case contains n (2 ≤ n ≤ 100000), the number of fixed points in each strikers motion sequence. It is followed by l0, l1, s0 and s1, the difficulty of a long-range pass to the corresponding striker and the difficulties of the shoots of the strikers. Each striker is described in two lines (first striker 0, then striker 1): The first line contains n-1 difficulties, where the i-th number stands for passing from point i to the other player at point i + 1. The second line also contains n - 1 difficulties, where the i-th number stands for dribbling from point i to point i + 1. You may safely assume that each difficulty is a non-negative integer less than 1000.

    Output

    Foreach test case in the input, print one line containing the minimal difficulty of a move sequence leading to a goal.

    Sample Input

    2
    3 3 5 7 999
    9 13
    60 5
    22 6
    5 5
    5 3 5 7 999
    9 13 8 4
    60 5 17 13
    22 6 15 11
    5 5 18 29

    Sample Output

    23
    42

    Source

    样例输入

    2
    3 3 5 7 999
    9 13
    60 5
    22 6
    5 5
    5 3 5 7 999
    9 13 8 4
    60 5 17 13
    22 6 15 11
    5 5 18 29

    样例输出

    23
    42

    提示

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部