CF1316E.Team Building

提高+/省选-

通过率:0%

时间限制:3.00s

内存限制:256MB

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.

FCB 俱乐部主席爱丽丝希望为即将举行的排球锦标赛组建一支队伍。该队伍需由 pp 名球员组成,每人担任 pp 个不同位置中的一个。她也深知观众支持的重要性,因此还希望从中选出 kk 人作为观众。

Byteland 共有 nn 人。爱丽丝需从这 nn 人中恰好选出 pp 名球员(每个位置恰好一人),并恰好选出 kk 名观众。她的最终目标是使俱乐部的总实力最大化。

第 ii 个人(1≤i≤n1 \le i \le n)具有一个整数 aia_i,表示若此人被选为观众,他将为俱乐部贡献的实力值。

对于每个人 ii 和每个位置 jj(1≤j≤p1 \le j \le p),爱丽丝已知 si,js_{i,j} —— 表示若第 ii 个人被安排在第 jj 个位置上担任球员,他将为俱乐部贡献的实力值。

每个人最多只能被选中一次(即不能同时担任球员和观众,也不能在多个位置上重复担任球员)。且必须为每个位置恰好指定一名球员。

由于爱丽丝事务繁忙,她需要你帮她找出:通过最优地选择球员与观众,所能达到的俱乐部最大总实力。

输入格式

The first line contains 33 integers n,p,kn,p,k (2≤n≤105,1≤p≤7,1≤k,p+k≤n2 \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}. (1≤ai≤1091 \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}. (1≤si,j≤1091 \leq s_{i,j} \leq 10^{9})

第一行包含 33 个整数 n,p,kn,p,k(满足 2≤n≤1052 \leq n \leq 10^{5},1≤p≤71 \leq p \leq 7,1≤k1 \le k 且 p+k≤np+k \le n)。

第二行包含 nn 个整数 a1,a2,…,ana_{1},a_{2},\ldots,a_{n}(满足 1≤ai≤1091 \leq a_{i} \leq 10^{9})。

接下来的 nn 行中,第 ii 行包含 pp 个整数 si,1,si,2,…,si,ps_{i, 1}, s_{i, 2}, \dots, s_{i, p}(满足 1≤si,j≤1091 \leq s_{i,j} \leq 10^{9})。

输出格式

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

输出一个整数 res{res} —— 球队可能达到的最大实力值。

输入输出样例

  • 输入#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}.

在第一个样例中,我们可以选择第 11 个人担任第 11 个位置的选手,而第 22 和第 33 个人作为观众。此时俱乐部的总实力等于 a2+a3+s1,1a_{2}+a_{3}+s_{1,1}。

输入解题思路,AI测评打分。不知道怎么写?

首页