結果

問題 No.2708 Jewel holder
コンテスト
ユーザー hato336
提出日時 2024-03-31 13:37:48
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 139 ms / 2,000 ms
コード長 780 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 241 ms
コンパイル使用メモリ 85,376 KB
実行使用メモリ 87,936 KB
最終ジャッジ日時 2026-04-16 20:12:50
合計ジャッジ時間 3,264 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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