結果
| 問題 |
No.971 いたずらっ子
|
| コンテスト | |
| ユーザー |
vwxyz
|
| 提出日時 | 2024-05-03 06:45:06 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 355 bytes |
| コンパイル時間 | 126 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 123,208 KB |
| 最終ジャッジ日時 | 2024-11-24 04:32:30 |
| 合計ジャッジ時間 | 29,696 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 14 TLE * 7 |
ソースコード
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