結果

問題 No.2708 Jewel holder
ユーザー konchakoncha
提出日時 2024-03-31 13:45:18
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 701 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 83,144 KB
最終ジャッジ日時 2024-03-31 13:45:24
合計ジャッジ時間 1,853 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,460 KB
testcase_01 AC 35 ms
53,460 KB
testcase_02 AC 36 ms
53,460 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 AC 35 ms
53,460 KB
testcase_06 AC 35 ms
53,460 KB
testcase_07 AC 35 ms
53,460 KB
testcase_08 AC 35 ms
53,460 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 34 ms
53,460 KB
testcase_15 AC 52 ms
66,304 KB
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

H, W = map(int, input().split())
A = [input() for _ in range(H)]

answer = 0
perm = [["", 0, 0]]

for _ in range(H+W-2):
    np = []
    for p in perm:
        if p[1] != W-1:
            np.append([p[0]+"D", p[1]+1, p[2]])
        if p[2] != H-1:
            np.append([p[0]+"R", p[1], p[2]+1])
    perm = np

for pattern in perm:
    pattern = pattern[0]
    cnt = 1
    h, w = 0, 0
    for p in pattern:
        if p == "D":
            h += 1
        else:
            w += 1
        if A[h][w] == "#":
            break
        elif A[h][w] == "x":
            cnt -= 1
            if cnt < 0:
                break
        else:
            cnt += 1
    else:
        answer += 1

print(answer)
0