結果

問題 No.2708 Jewel holder
ユーザー graph11463graph11463
提出日時 2024-03-31 14:45:52
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 744 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 81,828 KB
実行使用メモリ 63,012 KB
最終ジャッジ日時 2024-03-31 14:45:56
合計ジャッジ時間 1,628 ms
ジャッジサーバーID
(参考情報)
judge10 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

'''input'''
i1=lambda:int(s1())
i2=lambda:map(int,s2())
il=lambda:list(i2())
s1=lambda:input()
s2=lambda:s1().split()
sl=lambda:list(s2())
'''output'''
yn=lambda b:print("Yes" if b else "No")
'''createList'''
cl=lambda x,d:[d for i in range(x)]# a=c2l(10,23,"x")
'''code'''
from functools import cache
H,W=i2()
ma=[["#" for i in range(W+1)]for j in range(H+1)]
for i in range(H):
    s=s1()
    for j in range(W):
        ma[i][j]=s[j]
@cache
def b(i,j,num):
    u=num
    if i==H-1 and j==W-1:
        return 1
    if ma[i][j]=="x":
        u-=1
        if u==0:
            return 0
    if ma[i][j]=="o":
        u+=1
    if ma[i][j]=="#":
        return 0
    print(i,j,b(i+1,j,u)+b(i,j+1,u))
    return b(i+1,j,u)+b(i,j+1,u)
print(b(0,0,1))
0