結果

問題 No.2708 Jewel holder
ユーザー hato336hato336
提出日時 2024-03-31 13:37:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 208 ms / 2,000 ms
コード長 780 bytes
コンパイル時間 145 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 89,528 KB
最終ジャッジ日時 2024-03-31 13:37:55
合計ジャッジ時間 3,923 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
84,920 KB
testcase_01 AC 124 ms
84,920 KB
testcase_02 AC 149 ms
84,920 KB
testcase_03 AC 127 ms
84,920 KB
testcase_04 AC 126 ms
84,920 KB
testcase_05 AC 125 ms
84,920 KB
testcase_06 AC 125 ms
84,920 KB
testcase_07 AC 126 ms
84,920 KB
testcase_08 AC 145 ms
88,888 KB
testcase_09 AC 140 ms
88,632 KB
testcase_10 AC 168 ms
89,144 KB
testcase_11 AC 157 ms
89,144 KB
testcase_12 AC 127 ms
84,920 KB
testcase_13 AC 156 ms
89,016 KB
testcase_14 AC 128 ms
84,920 KB
testcase_15 AC 157 ms
89,144 KB
testcase_16 AC 138 ms
88,760 KB
testcase_17 AC 208 ms
89,528 KB
testcase_18 AC 173 ms
89,272 KB
testcase_19 AC 180 ms
89,272 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random
#sys.setrecursionlimit(10**9)
#sys.set_int_max_str_digits(0)
#input = sys.stdin.readline
h,w = map(int,input().split())
grid = [list(input().rstrip()) for i in range(h)]
ans = 0
for i in itertools.product([0,1],repeat=h+w-2):
    temp = 1
    x,y = 0,0
    check = 1
    for j in range(h+w-2):
        if i[j] == 0:
            x += 1
        else:
            y += 1
        if 0 <= x < h and 0 <= y < w:
            if temp == 0 and grid[x][y] == 'x' or grid[x][y] == '#':
                check = 0
                break
            temp += 1 if grid[x][y] == 'o' else 0 if grid[x][y] == '#' else -1
        else:
            check = 0
            break
    ans += check
print(ans)
0