結果
| 問題 |
No.2708 Jewel holder
|
| ユーザー |
|
| 提出日時 | 2024-11-01 20:23:28 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 34 ms / 2,000 ms |
| コード長 | 521 bytes |
| コンパイル時間 | 304 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-11-01 20:23:30 |
| 合計ジャッジ時間 | 1,986 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
def dfs(y, x, cnt):
if A[y][x] == "o":
cnt += 1
if A[y][x] == "x":
cnt -= 1
if A[y][x] == "#":
cnt = -float("INF")
if cnt < 0: return
if y == H - 1 and x == W - 1:
global ans
ans += 1
if y != H - 1:
dfs(y + 1, x, cnt)
if x != W - 1:
dfs(y, x + 1, cnt)
H, W = map(int, input().split())
A = [list(input()[:-1]) for _ in range(H)]
ans = 0
dfs(0, 0, 0)
print(ans)