結果
| 問題 |
No.2708 Jewel holder
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-31 14:53:16 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 797 bytes |
| コンパイル時間 | 183 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-09-30 20:03:30 |
| 合計ジャッジ時間 | 1,541 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 WA * 10 |
ソースコード
H, W = map(int, input().split())
world = []
for i in range(H):
world.append(list(e for e in input()))
# print(world)
chash = dict()
def how_much(h, w, state):
global H, W, chash, world
if h == H & w == W:
return 1
if h > H or w > W:
return 0
if world[h - 1][w - 1] == "#":
return 0
if world[h - 1][w - 1] == "o":
state += 1
if world[h - 1][w - 1] == "x":
state -= 1
if state <= -1:
return 0
# print(how_much(h + 1, w) + how_much(h, w + 1))
if (h, w) not in chash.keys():
chash["x:{},y:{},state:{}".format(h, w, state)] = how_much(
h + 1, w, state
) + how_much(h, w + 1, state)
return chash["x:{},y:{},state:{}".format(h, w, state)]
# print(chash)
print(how_much(1, 1, 0))