結果
| 問題 |
No.2708 Jewel holder
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-11-01 20:16:42 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 699 bytes |
| コンパイル時間 | 437 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-11-01 20:16:45 |
| 合計ジャッジ時間 | 1,880 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 3 |
| other | RE * 17 |
ソースコード
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
from more_itertools import distinct_permutations
H, W = map(int, input().split())
A = [list(input()[:-1]) for _ in range(H)]
ans = 0
for E in distinct_permutations([0] * (H - 1) + [1] * (W - 1)):
cnt = 1
y, x = 0, 0
flag = True
for e in E:
if e == 0:
y += 1
else:
x += 1
if A[y][x] == "o":
cnt += 1
if A[y][x] == "x":
cnt -= 1
if cnt < 0:
flag = False
break
if A[y][x] == "#":
flag = False
break
if not flag: continue
ans += 1
print(ans)