結果

問題 No.2430 Damage Zone
ユーザー ramdosramdos
提出日時 2023-08-11 16:10:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 182 ms / 2,000 ms
コード長 803 bytes
コンパイル時間 179 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 76,904 KB
最終ジャッジ日時 2024-04-29 09:16:14
合計ジャッジ時間 3,653 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
76,544 KB
testcase_01 AC 109 ms
76,672 KB
testcase_02 AC 182 ms
76,904 KB
testcase_03 AC 64 ms
65,280 KB
testcase_04 AC 65 ms
65,920 KB
testcase_05 AC 72 ms
68,608 KB
testcase_06 AC 41 ms
51,584 KB
testcase_07 AC 42 ms
51,584 KB
testcase_08 AC 41 ms
51,968 KB
testcase_09 AC 41 ms
52,096 KB
testcase_10 AC 40 ms
51,712 KB
testcase_11 AC 82 ms
71,808 KB
testcase_12 AC 80 ms
70,784 KB
testcase_13 AC 55 ms
60,800 KB
testcase_14 AC 170 ms
76,544 KB
testcase_15 AC 166 ms
76,672 KB
testcase_16 AC 169 ms
76,544 KB
testcase_17 AC 111 ms
76,288 KB
testcase_18 AC 98 ms
76,160 KB
testcase_19 AC 59 ms
64,000 KB
testcase_20 AC 118 ms
76,288 KB
testcase_21 AC 77 ms
70,016 KB
testcase_22 AC 58 ms
62,336 KB
testcase_23 AC 60 ms
62,720 KB
testcase_24 AC 58 ms
62,208 KB
testcase_25 AC 98 ms
76,416 KB
testcase_26 AC 111 ms
76,288 KB
testcase_27 AC 96 ms
76,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

H,W,K=map(int,input().split())
S = [input() for i in range(H)]
dp_old = [[0 for i in range(W)] for j in range(H)]
ans = 0
for k in range(K):
    dp_new = [[0 for i in range(W)] for j in range(H)]
    if k==0:
        dp_new[0][0]=1
    for i in range(H):
        for j in range(W):
            if S[i][j]=='.':
                if i!=0:
                    dp_new[i][j]=(dp_new[i][j]+dp_new[i-1][j])%998244353
                if j!=0:
                    dp_new[i][j]=(dp_new[i][j]+dp_new[i][j-1])%998244353
            if S[i][j]=='o':
                if i!=0:
                    dp_new[i][j]=(dp_new[i][j]+dp_old[i-1][j])%998244353
                if j!=0:
                    dp_new[i][j]=(dp_new[i][j]+dp_old[i][j-1])%998244353
    dp_old = dp_new
    ans=(ans+dp_old[H-1][W-1])%998244353
print(ans)
0