結果

問題 No.2708 Jewel holder
ユーザー konchakoncha
提出日時 2024-03-31 13:40:45
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 538 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 81,300 KB
最終ジャッジ日時 2024-03-31 13:40:52
合計ジャッジ時間 3,910 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

from itertools import permutations


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

answer = 0
perm = list(set(permutations("D"*(H-1)+"R"*(W-1), H+W-2)))
for pattern in perm:
    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