結果
| 問題 | No.2708 Jewel holder |
| コンテスト | |
| ユーザー |
Cecil
|
| 提出日時 | 2024-03-31 13:49:45 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 672 bytes |
| 記録 | |
| コンパイル時間 | 213 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-09-30 18:27:54 |
| 合計ジャッジ時間 | 1,429 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 WA * 8 |
ソースコード
import sys
sys.setrecursionlimit(1 << 20)
H,W = map(int, input().split())
A = [ list(input()) for _ in range(H) ]
dx = [0,1]
dy = [1,0]
global ans
ans = 0
def dfs(sx,sy,cnt):
global ans
if sx==H-1 and sy==W-1:
#print(ans)
ans += 1
return
for x,y in zip(dx,dy):
if not (0<=sx+x<=H-1):
continue
if not (0<=sy+y<=W-1):
continue
if A[sx+x][sy+y]=="#":
continue
if A[sx+x][sy+y]=="x" and cnt==0:
continue
if A[sx+x][sy+y]=="x":
cnt -= 1
elif A[sx+x][sy+y]=="o":
cnt += 1
dfs(sx+x,sy+y,cnt)
dfs(0,0,1)
print(ans)
Cecil