結果

問題 No.2708 Jewel holder
ユーザー konchakoncha
提出日時 2024-03-31 13:46:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 101 ms / 2,000 ms
コード長 701 bytes
コンパイル時間 204 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 89,428 KB
最終ジャッジ日時 2024-03-31 13:46:28
合計ジャッジ時間 1,848 ms
ジャッジサーバーID
(参考情報)
judge15 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,460 KB
testcase_01 AC 40 ms
53,460 KB
testcase_02 AC 37 ms
53,460 KB
testcase_03 AC 36 ms
53,460 KB
testcase_04 AC 36 ms
53,460 KB
testcase_05 AC 36 ms
53,460 KB
testcase_06 AC 37 ms
53,460 KB
testcase_07 AC 37 ms
53,460 KB
testcase_08 AC 37 ms
53,460 KB
testcase_09 AC 37 ms
53,460 KB
testcase_10 AC 37 ms
53,460 KB
testcase_11 AC 44 ms
61,864 KB
testcase_12 AC 36 ms
53,460 KB
testcase_13 AC 45 ms
61,996 KB
testcase_14 AC 37 ms
53,460 KB
testcase_15 AC 55 ms
66,176 KB
testcase_16 AC 37 ms
53,460 KB
testcase_17 AC 101 ms
89,428 KB
testcase_18 AC 71 ms
77,084 KB
testcase_19 AC 59 ms
72,348 KB
権限があれば一括ダウンロードができます

ソースコード

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] != H-1:
            np.append([p[0]+"D", p[1]+1, p[2]])
        if p[2] != W-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