結果

問題 No.2708 Jewel holder
ユーザー prd_xxxprd_xxx
提出日時 2024-03-31 13:44:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 486 bytes
コンパイル時間 2,316 ms
コンパイル使用メモリ 81,444 KB
実行使用メモリ 75,688 KB
最終ジャッジ日時 2024-03-31 13:44:05
合計ジャッジ時間 1,865 ms
ジャッジサーバーID
(参考情報)
judge10 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,460 KB
testcase_01 AC 37 ms
53,460 KB
testcase_02 AC 41 ms
53,460 KB
testcase_03 AC 37 ms
53,460 KB
testcase_04 AC 37 ms
53,460 KB
testcase_05 AC 37 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 43 ms
59,844 KB
testcase_12 AC 37 ms
53,460 KB
testcase_13 AC 43 ms
59,848 KB
testcase_14 AC 37 ms
53,460 KB
testcase_15 AC 51 ms
64,180 KB
testcase_16 AC 37 ms
53,460 KB
testcase_17 AC 79 ms
75,688 KB
testcase_18 AC 62 ms
72,600 KB
testcase_19 AC 57 ms
68,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

from itertools import combinations

ans = 0
for ptn in combinations(range(H+W-2), H-1):
    sptn = set(ptn)
    i = j = 0
    h = 1
    for k in range(H+W-2):
        if k in sptn:
            i += 1
        else:
            j += 1
        if A[i][j]=='#': break
        if A[i][j]=='o':
            h += 1
        else:
            h -= 1
            if h < 0:
                break
    else:
        ans += 1
print(ans)
0