問題一覧 > 通常問題

No.2495 Three Sets

レベル : / AI推定難易度 : 2000 / 実行時間制限 : 1ケース 3.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 29
作問者 : KumaTachiRen / テスター : 👑 p-adic
お気に入りにしたユーザー ProblemId : 9467 / 自分の提出
問題文最終更新日: 2023-09-11 11:52:33
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 407 (順位表) の他の問題:

Problem Statement

You are given positive integers $N_A,N_B,N_C$ and integer sequences $(A_1,A_2,\dots,A_{N_A}),(B_1,B_2,\dots,B_{N_B}),(C_1,C_2,\dots,C_{N_C})$.

For a triple $(S_A,S_B,S_C)$ consisting of a subset $S_A$ of $\{1,2,\dots,N_A\}$, a subset $S_B$ of $\{1,2,\dots,N_B\}$, and a subset $S_C$ of $\{1,2,\dots,N_C\}$, its score is defined as follows. \[\left(\sum_{i\in S_A}A_i\right)|S_B|+\left(\sum_{j\in S_B}B_j\right)|S_C|+\left(\sum_{k\in S_C}C_k\right)|S_A|\]

Here, $|S|$ denotes the number of elements of a set $S$. Also, $\sum_{x\in S}f(x)$ denotes the sum of $f(x)$ over all elements $x$ of a set $S$; in particular, if $S$ is empty, then $\sum_{x\in S}f(x)=0$.

Find the maximum possible value of the score.

Note that the answer may not fit in a 32-bit integer type.

Input

$N_A\ N_B\ N_C$
$A_1\ A_2\ \dots\ A_{N_A}$
$B_1\ B_2\ \dots\ B_{N_B}$
$C_1\ C_2\ \dots\ C_{N_C}$

  • $1\leq N_A,N_B,N_C\leq 10^5$
  • $|A_i|,|B_j|,|C_k|\leq 3\times 10^3$
  • All input values are integers.

Output

Output the maximum possible value of the score. Print a newline at the end.

Sample

Sample 1
Input
2 3 3
-5 -2
2 -4 2
-3 -1 3
Output
12

For example, when $S_A=\{\},S_B=\{1,3\},S_C=\{1,2,3\}$, the score is $12$. It can be shown that the score cannot be made larger than this, so the value to output is $12$.

Sample 2
Input
4 4 4
-33 -333 -3 -33
-22 222 22 222
11 -11 111 11
Output
2023

Sample 3
Input
10 10 10
1211 -789 -318 1533 -2837 -1408 117 -30 2777 786
1770 -73 -846 282 2173 2234 2241 -303 -1617 168
498 1150 1730 -230 -1050 730 693 -700 794 349
Output
161276

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。