結果
| 問題 |
No.2708 Jewel holder
|
| コンテスト | |
| ユーザー |
茅ヶ崎裕太
|
| 提出日時 | 2024-03-31 14:06:58 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 325 ms / 2,000 ms |
| コード長 | 673 bytes |
| コンパイル時間 | 230 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 11,008 KB |
| 最終ジャッジ日時 | 2024-09-30 18:58:47 |
| 合計ジャッジ時間 | 2,009 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
import sys
import copy
sys.setrecursionlimit(10**4)
ans=0
def f(y,x,l,c,k):
global ans
if fi[y][x]=="o":
c+=1
elif fi[y][x]=="x":
c-=1
if c<0:
return
if y+1==H and x+1==W:
ans+=1
return
k.append([y,x])
l[y][x]=True
for i,j in[[1,0],[0,1]]:
if y+i<H and x+j<W :
if not l[y+i][x+j]:
if fi[y+i][x+j]!="#":
f(y+i,x+j,copy.deepcopy(l),c,k.copy())
H,W=map(int,input().split())
fi=[list(input()) for _ in range(H)]
l=[]
aa=[[False for _ in range(W)]for _ in range(H)]
f(0,0,aa,0,l)
print(ans)
茅ヶ崎裕太