問題一覧 > 通常問題

No.3293 Golden Cross

レベル : / AI推定難易度 : 2350 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 14
作問者 : kona0001 / テスター : tobisatis RyosukeFukatani koba-e964 ir5 drken1215
お気に入りにしたユーザー ProblemId : 12670 / 自分の提出
問題文最終更新日: 2025-09-28 04:07:08
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 485 (順位表) の他の問題:

Problem Statement

You are given a two-dimensional array $A$ with $H$ rows and $W$ columns. For this two-dimensional array, define the intersection value $C_{i,j}$ as $(i行目の和)\times(j列目の和)$, that is, as follows.

$$ C_{i,j} = \left(\sum_{k=1}^WA_{i,k}\right)\ \times\ \left(\sum_{l=1}^HA_{l,j}\right) $$

Also, define the score $S$ of this two-dimensional array $A$ as the maximum value of $C_{i,j}$, that is, as follows.

$$ S = \max_{1 \le i \le H, 1 \le j \le W} C_{i,j} $$

Consider performing the following operation on $A$ $0$ or more times.

  • Choose any $i,j$ $(1 \le i \le H, 1 \le j \le W)$. Spend a cost of $2^{B_{i,j}}$ and add $+1$ to $A_{i,j}$.

Given that you can spend a cost of up to $K$, find the maximum value of the score $S$ of the two-dimensional array $A$ after the operations.

Constraints

  • $2 \le H,W \le 600$
  • $1 \le K \le 2^{30}$
  • $1 \le A_{i,j} \le 10^6$
  • $0 \le B_{i,j} \le 30$
  • All input values are integers.

Input

The input is given from standard input in the following format.

$H\ W\ K$
$A_{1,1}\ A_{1,2}\ \ldots\ A_{1,W} $
$A_{2,1}\ A_{2,2}\ \ldots\ A_{2,W} $
$\vdots$
$A_{H,1}\ A_{H,2}\ \ldots\ A_{H,W} $
$B_{1,1}\ B_{1,2}\ \ldots\ B_{1,W} $
$B_{2,1}\ B_{2,2}\ \ldots\ B_{2,W} $
$\vdots$
$B_{H,1}\ B_{H,2}\ \ldots\ B_{H,W} $

Output

Output the maximum score of $A$ after the operations. End the output with a newline.

Sample

Sample 1
Input
2 2 6
1 2
3 4
1 1
2 2
Output
64

Perform the operations as follows.

  • Choose $i=1,j=2$. Spend a cost of $2^1$ and add $+1$ to $A_{1,2}$.
  • Choose $i=2,j=2$. Spend a cost of $2^2$ and add $+1$ to $A_{2,2}$.

After the operations, $A$ is

1 3
3 5

Here, $C_{2,2} = (3+5) \times (3+5) = 64$, and since this is the largest among the $C_{i,j}$, it is the score of $A$. No other way of performing the operations can make the score greater than $64$, so $64$ is the answer.

Sample 2
Input
5 6 67
6 5 46 35 48 5
34 1 20 46 45 5
41 19 38 49 30 22
32 48 41 12 38 24
30 4 8 37 15 37
1 0 4 1 2 2
2 3 4 4 0 2
3 3 1 4 0 2
0 4 0 3 0 1
4 3 3 1 3 4
Output
64638

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