結果
問題 | No.2708 Jewel holder |
ユーザー |
![]() |
提出日時 | 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 syssys.setrecursionlimit(1 << 20)H,W = map(int, input().split())A = [ list(input()) for _ in range(H) ]dx = [0,1]dy = [1,0]global ansans = 0def dfs(sx,sy,cnt):global ansif sx==H-1 and sy==W-1:#print(ans)ans += 1returnfor x,y in zip(dx,dy):if not (0<=sx+x<=H-1):continueif not (0<=sy+y<=W-1):continueif A[sx+x][sy+y]=="#":continueif A[sx+x][sy+y]=="x" and cnt==0:continueif A[sx+x][sy+y]=="x":cnt -= 1elif A[sx+x][sy+y]=="o":cnt += 1dfs(sx+x,sy+y,cnt)dfs(0,0,1)print(ans)