結果
| 問題 | No.2708 Jewel holder |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-11-01 20:23:28 |
| 言語 | Python3 (3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 22 ms / 2,000 ms |
| + 978µs | |
| コード長 | 521 bytes |
| 記録 | |
| コンパイル時間 | 57 ms |
| コンパイル使用メモリ | 15,104 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2026-09-19 08:30:50 |
| 合計ジャッジ時間 | 1,810 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)