結果

問題 No.2430 Damage Zone
ユーザー ramdosramdos
提出日時 2023-08-11 16:08:35
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,838 ms / 2,000 ms
コード長 803 bytes
コンパイル時間 244 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,520 KB
最終ジャッジ日時 2024-04-29 09:16:30
合計ジャッジ時間 14,606 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 927 ms
11,264 KB
testcase_01 AC 549 ms
11,008 KB
testcase_02 AC 1,675 ms
11,264 KB
testcase_03 AC 53 ms
10,880 KB
testcase_04 AC 80 ms
10,880 KB
testcase_05 AC 91 ms
10,752 KB
testcase_06 AC 30 ms
10,880 KB
testcase_07 AC 30 ms
10,880 KB
testcase_08 AC 31 ms
10,880 KB
testcase_09 AC 30 ms
10,880 KB
testcase_10 AC 31 ms
10,880 KB
testcase_11 AC 81 ms
10,752 KB
testcase_12 AC 84 ms
10,752 KB
testcase_13 AC 35 ms
10,752 KB
testcase_14 AC 1,739 ms
11,392 KB
testcase_15 AC 1,700 ms
11,392 KB
testcase_16 AC 1,838 ms
11,392 KB
testcase_17 AC 340 ms
11,008 KB
testcase_18 AC 104 ms
10,880 KB
testcase_19 AC 33 ms
10,880 KB
testcase_20 AC 686 ms
11,264 KB
testcase_21 AC 49 ms
10,752 KB
testcase_22 AC 40 ms
11,008 KB
testcase_23 AC 39 ms
11,008 KB
testcase_24 AC 40 ms
10,880 KB
testcase_25 AC 530 ms
11,520 KB
testcase_26 AC 757 ms
11,520 KB
testcase_27 AC 386 ms
11,392 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