結果
| 問題 | No.2708 Jewel holder |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-31 14:47:34 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 770 bytes |
| コンパイル時間 | 236 ms |
| コンパイル使用メモリ | 82,548 KB |
| 実行使用メモリ | 67,828 KB |
| 最終ジャッジ日時 | 2024-09-30 19:57:18 |
| 合計ジャッジ時間 | 1,957 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 RE * 1 |
| other | WA * 5 RE * 12 |
ソースコード
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, state
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:{}".format(h, w)] = how_much(h + 1, w, state) + how_much(
h, w + 1, state
)
return chash["x:{},y:{}".format(h, w)]
# print(chash)
print(how_much(1, 1, 0))