結果

問題 No.2708 Jewel holder
ユーザー hato336hato336
提出日時 2024-03-31 13:37:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 198 ms / 2,000 ms
コード長 780 bytes
コンパイル時間 206 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 90,496 KB
最終ジャッジ日時 2024-09-30 18:10:09
合計ジャッジ時間 4,017 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

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