CF1316E.Team Building

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Alice, the president of club FCB, wants to build a team for the new volleyball tournament. The team should consist of pp players playing in pp different positions. She also recognizes the importance of audience support, so she wants to select kk people as part of the audience.

There are nn people in Byteland. Alice needs to select exactly pp players, one for each position, and exactly kk members of the audience from this pool of nn people. Her ultimate goal is to maximize the total strength of the club.

The ii -th of the nn persons has an integer aia_{i} associated with him — the strength he adds to the club if he is selected as a member of the audience.

For each person ii and for each position jj , Alice knows si,js_{i, j} — the strength added by the ii -th person to the club if he is selected to play in the jj -th position.

Each person can be selected at most once as a player or a member of the audience. You have to choose exactly one player for each position.

Since Alice is busy, she needs you to help her find the maximum possible strength of the club that can be achieved by an optimal choice of players and the audience.

输入格式

The first line contains 33 integers n,p,kn,p,k ( 2n105,1p7,1k,p+kn2 \leq n \leq 10^{5}, 1 \leq p \leq 7, 1 \le k, p+k \le n ).

The second line contains nn integers a1,a2,,ana_{1},a_{2},\ldots,a_{n} . ( 1ai1091 \leq a_{i} \leq 10^{9} ).

The ii -th of the next nn lines contains pp integers si,1,si,2,,si,ps_{i, 1}, s_{i, 2}, \dots, s_{i, p} . ( 1si,j1091 \leq s_{i,j} \leq 10^{9} )

输出格式

Print a single integer res{res} — the maximum possible strength of the club.

输入输出样例

  • 输入#1

    4 1 2
    1 16 10 3
    18
    19
    13
    15

    输出#1

    44
  • 输入#2

    6 2 3
    78 93 9 17 13 78
    80 97
    30 52
    26 17
    56 68
    60 36
    84 55

    输出#2

    377
  • 输入#3

    3 2 1
    500 498 564
    100002 3
    422332 2
    232323 1

    输出#3

    422899

说明/提示

In the first sample, we can select person 11 to play in the 11 -st position and persons 22 and 33 as audience members. Then the total strength of the club will be equal to a2+a3+s1,1a_{2}+a_{3}+s_{1,1} .

首页