結果
問題 | No.2855 Move on Grid |
ユーザー |
![]() |
提出日時 | 2024-08-25 14:26:28 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 916 bytes |
コンパイル時間 | 239 ms |
コンパイル使用メモリ | 82,452 KB |
実行使用メモリ | 117,924 KB |
最終ジャッジ日時 | 2024-08-25 14:26:56 |
合計ジャッジ時間 | 16,930 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | AC | 457 ms
115,960 KB |
testcase_11 | AC | 442 ms
115,952 KB |
testcase_12 | AC | 424 ms
115,824 KB |
testcase_13 | AC | 456 ms
115,252 KB |
testcase_14 | AC | 404 ms
116,164 KB |
testcase_15 | AC | 466 ms
116,124 KB |
testcase_16 | AC | 466 ms
115,024 KB |
testcase_17 | AC | 427 ms
116,164 KB |
testcase_18 | AC | 412 ms
115,984 KB |
testcase_19 | AC | 450 ms
115,888 KB |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
ソースコード
from collections import* n, m, k = map(int, input().split()) a = [list(map(int, input().split())) for _ in range(n)] ng = 10 ** 9 + 1 ok = 0 while abs(ok - ng) > 1: mid = (ok + ng) // 2 # begin mid が ok かどうか判定する為の前処理 dp = [[-1] * m for _ in range(n)] dp[0][0] = int(a[0][0] < mid) q = deque([(0, 0)]) while q: i, j = q.popleft() for x, y in [(i - 1, j), (i, j - 1), (i, j + 1), (i + 1, j)]: if 0 <= x < n and 0 <= y < m and dp[x][y] == -1: if a[x][y] >= mid: dp[x][y] = dp[i][j] q.appendleft((x, y)) else: dp[x][y] = dp[i][j] + 1 q.appendleft((x, y)) # end mid が ok かどうか判定する為の前処理 if dp[-1][-1] <= k: # mid が ok の場合の条件 ok = mid else: ng = mid print(ok)