結果
問題 |
No.2708 Jewel holder
|
ユーザー |
|
提出日時 | 2024-11-01 20:11:51 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 681 bytes |
コンパイル時間 | 345 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 17,700 KB |
最終ジャッジ日時 | 2024-11-01 20:11:55 |
合計ジャッジ時間 | 4,481 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 TLE * 1 -- * 11 |
ソースコード
import sys input = sys.stdin.readline sys.setrecursionlimit(10**8) from itertools import permutations H, W = map(int, input().split()) A = [list(input()[:-1]) for _ in range(H)] ans = 0 for E in set(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)