問題一覧 > 通常問題

No.2855 Move on Grid

レベル : / AI推定難易度 : 1250 / 実行時間制限 : 1ケース 3.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 106
作問者 : dyktr_06 / テスター : sepa38 ryota2357 square1001
お気に入りにしたユーザー ProblemId : 10267 / 自分の提出
問題文最終更新日: 2024-08-25 10:08:52
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 442 MMA Contest 019 (順位表) の他の問題:

Problem Statement

There is an $N \times M$ grid.

The cell $(i, j)$ in the $i$-th row from the top and the $j$-th column from the left has an integer $A_{i, j}$ written on it.

You are going to travel from the top-left cell $(1, 1)$ to the bottom-right cell $(N, M)$ by moving up, down, left, or right.

You may perform the following action up to $K$ times.

  • Choose integers $i, j$ satisfying $1 \leq i \leq N, 1 \leq j \leq M$, and change the integer written on cell $(i, j)$ to any integer from $1$ to $10^{9}$.

The score is the minimum of the integers written on the cells you passed through during the move, including $(1, 1) と (N, M)$.

Find the maximum possible score.


Constraints

  • $2 \leq N, M \leq 300$
  • $0 \leq K \leq N \times M$
  • $1 \leq A_{i, j} \leq 10^{9}$
  • All input values are integers.

Input

The input is given from Standard Input in the following format.

$N$ $M$ $K$ 
$A_{1,1}$ $A_{1,2}$ ... $A_{1,M}$  
$A_{2,1}$ $A_{2,2}$ ... $A_{2,M}$  
$\vdots$

$A_{N,1}$ $A_{N,2}$ ... $A_{N,M}$  

Output

Print the answer to the problem on one line.

Sample

Sample 1
Input
3 3 2
1 2 4
3 5 7
6 8 9
Output
6

For example, if you change the integer written on cell $(1, 1)$ to $7$ and the integer written on cell $(2, 1)$ to $8$, you can achieve a score of $6$.

Sample 2
Input
5 5 0
1 7 7 7 7
1 7 1 1 1
1 7 1 7 1
1 7 1 7 1
1 1 1 7 1
Output
1

Note that you can move up, down, left, and right.

Sample 3
Input
2 3 6
2 3 3
5 7 8
Output
1000000000

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