結果
| 問題 |
No.2708 Jewel holder
|
| コンテスト | |
| ユーザー |
detteiuu
|
| 提出日時 | 2024-04-11 01:41:00 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 72 ms / 2,000 ms |
| コード長 | 462 bytes |
| コンパイル時間 | 172 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 68,352 KB |
| 最終ジャッジ日時 | 2024-10-02 21:09:10 |
| 合計ジャッジ時間 | 1,937 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
H, W = map(int, input().split())
A = [list(input()) for _ in range(H)]
def dfs(h, w, c):
cnt = 0
if h == H-1 and w == W-1:
return 1
if A[h][w] == "o":
c += 1
elif A[h][w] == "x":
c -= 1
if h < H-1 and A[h+1][w] != "#" and (c >= 1 or A[h+1][w] != "x"):
cnt += dfs(h+1, w, c)
if w < W-1 and A[h][w+1] != "#" and (c >= 1 or A[h][w+1] != "x"):
cnt += dfs(h, w+1, c)
return cnt
print(dfs(0, 0, 0))
detteiuu