結果

問題 No.971 いたずらっ子
ユーザー first_vilfirst_vil
提出日時 2020-09-25 13:37:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 250 ms / 2,000 ms
コード長 322 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 87,088 KB
実行使用メモリ 110,068 KB
最終ジャッジ日時 2023-08-07 08:09:13
合計ジャッジ時間 4,658 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 249 ms
108,840 KB
testcase_01 AC 250 ms
108,544 KB
testcase_02 AC 208 ms
92,412 KB
testcase_03 AC 188 ms
108,784 KB
testcase_04 AC 184 ms
110,068 KB
testcase_05 AC 181 ms
108,404 KB
testcase_06 AC 155 ms
91,156 KB
testcase_07 AC 81 ms
75,968 KB
testcase_08 AC 111 ms
82,788 KB
testcase_09 AC 109 ms
83,244 KB
testcase_10 AC 73 ms
75,848 KB
testcase_11 AC 69 ms
71,512 KB
testcase_12 AC 69 ms
71,252 KB
testcase_13 AC 74 ms
75,964 KB
testcase_14 AC 99 ms
77,016 KB
testcase_15 AC 73 ms
75,928 KB
testcase_16 AC 73 ms
71,532 KB
testcase_17 AC 69 ms
71,544 KB
testcase_18 AC 69 ms
71,544 KB
testcase_19 AC 69 ms
71,368 KB
testcase_20 AC 69 ms
71,536 KB
testcase_21 AC 70 ms
71,260 KB
testcase_22 AC 69 ms
71,392 KB
testcase_23 AC 67 ms
71,176 KB
testcase_24 AC 70 ms
71,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    h,w=map(int,input().split())
    s=[input() for _ in range(h)]
    dp=[[10**9]*(w+1) for _ in range(h+1)]
    dp[1][1]=0
    for i in range(h):
        for j in range(w):
            if i|j:
                dp[i+1][j+1]=min(dp[i+1][j],dp[i][j+1])+(i+j+1 if s[i][j]=='k' else 1)
    print(dp[-1][-1])
main()
0