結果

問題 No.3071 Double Speedrun
ユーザー nikoro256
提出日時 2025-03-21 23:19:46
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,046 bytes
コンパイル時間 312 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 72,308 KB
最終ジャッジ日時 2025-03-21 23:19:59
合計ジャッジ時間 8,759 ms
ジャッジサーバーID
(参考情報)
judge7 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other WA * 1 TLE * 1 -- * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

from copy import deepcopy
H,W=map(int,input().split())
S=[]
p=998244353
for i in range(H):
    S.append(input())
dp=[[0]*H for _ in range(W)]
dp[1][1]=1
for i in range(H):
    dp_d=[[0]*H for _ in range(W)]
    for j in range(W):
        for k in range(H):
            t=i+j-k
            if t<0 or t>=W:
                continue
            for d in range(4):
                i_=i
                j_=j
                k_=k
                t_=t
                if d%2==0:
                    t_+=1
                else:
                    k_+=1
                if d//2==0:
                    i_+=1
                else:
                    j_+=1
                #print(i_,j_,k_,t_,"<-",i,j,k,t)
                if not (i_<H and j_<W and t_<H and k_<W):
                    continue
                if S[i_][j_]==S[k_][t_]=="." and ((i_!=k_ or j_!=t_) or (i_==j_==H-1 and k_==t_==W-1)):
                    dp_d[j_][k_]+=dp[j][k]
                    dp_d[j_][k_]=dp_d[j_][k_]%p
    dp=deepcopy(dp_d)
#for d in dp:
#    print(d)
print(dp[-1][-1])
0