結果
| 問題 | No.971 いたずらっ子 |
| コンテスト | |
| ユーザー |
vwxyz
|
| 提出日時 | 2024-05-03 06:45:06 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 355 bytes |
| 記録 | |
| コンパイル時間 | 670 ms |
| コンパイル使用メモリ | 20,700 KB |
| 実行使用メモリ | 177,116 KB |
| 最終ジャッジ日時 | 2026-05-18 01:55:05 |
| 合計ジャッジ時間 | 7,925 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 4 |
| other | TLE * 1 -- * 20 |
ソースコード
H,W=map(int,input().split())
A=[input() for h in range(H)]
inf=1<<30
dp=[[inf]*W for h in range(H)]
dp[0][0]=0
for h in range(H):
for w in range(W):
if h:
dp[h][w]=min(dp[h][w],dp[h-1][w]+1)
if w:
dp[h][w]=min(dp[h][w],dp[h][w-1]+1)
if A[h][w]=="k":
dp[h][w]+=h+w
ans=dp[H-1][W-1]
print(ans)
vwxyz