結果

問題 No.2708 Jewel holder
ユーザー CecilCecil
提出日時 2024-03-31 13:49:45
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 672 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 10,112 KB
最終ジャッジ日時 2024-03-31 13:49:55
合計ジャッジ時間 1,465 ms
ジャッジサーバーID
(参考情報)
judge14 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import sys
sys.setrecursionlimit(1 << 20)
H,W = map(int, input().split())
A = [ list(input()) for _ in range(H) ]

dx = [0,1]
dy = [1,0]
global ans
ans = 0

def dfs(sx,sy,cnt):
    global ans
    if sx==H-1 and sy==W-1:
        #print(ans)
        ans += 1
        return
    for x,y in zip(dx,dy):
        if not (0<=sx+x<=H-1):
            continue
        if not (0<=sy+y<=W-1):
            continue
        if A[sx+x][sy+y]=="#":
            continue
        if A[sx+x][sy+y]=="x" and cnt==0:
            continue
        if A[sx+x][sy+y]=="x":
            cnt -= 1
        elif A[sx+x][sy+y]=="o":
            cnt += 1
        dfs(sx+x,sy+y,cnt)
dfs(0,0,1)
print(ans)
0