結果
| 問題 | No.2708 Jewel holder |
| コンテスト | |
| ユーザー |
かもめのうで
|
| 提出日時 | 2024-03-31 21:53:48 |
| 言語 | PyPy3 (8.0.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 50 ms / 2,000 ms |
| + 760µs | |
| コード長 | 630 bytes |
| 記録 | |
| コンパイル時間 | 84 ms |
| コンパイル使用メモリ | 65,020 KB |
| 実行使用メモリ | 59,372 KB |
| 最終ジャッジ日時 | 2026-10-20 21:17:48 |
| 合計ジャッジ時間 | 2,565 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge6_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 |
ソースコード
from collections import deque
h, w = map(int, input().split())
a = [list(input()) for _ in range(h)]
# どのように行っても最短路
dij = [(1, 0), (0, 1)]
ans = 0
stack = [(1, 0, 0)]
while stack:
t, i, j = stack.pop()
for di, dj in dij:
ni = i+di
nj = j+dj
nt = t
if not(0<=ni<h and 0<=nj<w and a[ni][nj] != "#"):
continue
if a[ni][nj] == "o":
nt += 1
else:
nt -= 1
if nt < 0:
continue
if ni == h-1 and nj == w-1:
ans += 1
else:
stack.append((nt, ni, nj))
print(ans)
かもめのうで