21756_Arrays

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

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

Pro.ID

21756

Title

Arrays

Title链接

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

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 40000/20000 MS (Java/Others)     Memory Limit: 262144/262144 K (Java/Others)
  • 描述

    You are given a sequence of 3*N integers ( X1, X2, ... , X3*n). Create three sequences ( A1, A2, ... , AN ),

    ( B1, B2, ..., BN ) and ( C1, C2, ..., CN ) such that:

    • each of the integers from 1 to 3*N belongs to exactly one of the sequences A, B or C;

    • the value of is the largest possible.

    输入

    The input file contains T test cases, all having the same value of N. The first line of the input file contains the integers T

    and N, constrained as shown in the adjacent table. Each of the following T lines describes one test case and contains 3*N

    integers, the members of the sequence X. All these values are in the range from 0 to 1000.

    Constraints on N       Constraints on T

    1 ≤ N ≤ 10               1 ≤ T ≤ 1000

    11 ≤ N ≤ 15             1 ≤ T ≤ 100

    16 ≤ N ≤ 20             1 ≤ T ≤ 10

    21 ≤ N ≤ 25             T = 1

    输出

    Description

    You are given a sequence of 3*N integers ( X1, X2, ... , X3*n). Create three sequences ( A1, A2, ... , AN ),

    ( B1, B2, ..., BN ) and ( C1, C2, ..., CN ) such that:

    • each of the integers from 1 to 3*N belongs to exactly one of the sequences A, B or C;

    • the value of is the largest possible.

    Input

    The input file contains T test cases, all having the same value of N. The first line of the input file contains the integers T

    and N, constrained as shown in the adjacent table. Each of the following T lines describes one test case and contains 3*N

    integers, the members of the sequence X. All these values are in the range from 0 to 1000.

    Constraints on N       Constraints on T

    1 ≤ N ≤ 10               1 ≤ T ≤ 1000

    11 ≤ N ≤ 15             1 ≤ T ≤ 100

    16 ≤ N ≤ 20             1 ≤ T ≤ 10

    21 ≤ N ≤ 25             T = 1

    Output

    The output file should consist of T lines. Each line should contain the largest possible value of S for the corresponding test case from the input file.

    Sample Input

    1 2
    4 1 8 2 0 5

    Sample Output

    46

    Hint

    Note. The maximal value is attained by taking A = (1, 3), B = (2, 5), C = (4, 6).

    Source

    样例输入

    1 2
    4 1 8 2 0 5

    样例输出

    46

    提示

    Note. The maximal value is attained by taking A = (1, 3), B = (2, 5), C = (4, 6).


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部