結果

問題 No.2708 Jewel holder
ユーザー 👑 KA37RIKA37RI
提出日時 2024-03-31 14:10:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 51 ms / 2,000 ms
コード長 555 bytes
コンパイル時間 180 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 61,992 KB
最終ジャッジ日時 2024-03-31 14:10:20
合計ジャッジ時間 1,827 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,460 KB
testcase_01 AC 40 ms
53,460 KB
testcase_02 AC 40 ms
53,460 KB
testcase_03 AC 41 ms
53,460 KB
testcase_04 AC 39 ms
53,460 KB
testcase_05 AC 40 ms
53,460 KB
testcase_06 AC 41 ms
53,460 KB
testcase_07 AC 42 ms
53,460 KB
testcase_08 AC 40 ms
53,460 KB
testcase_09 AC 41 ms
53,460 KB
testcase_10 AC 41 ms
53,460 KB
testcase_11 AC 41 ms
53,460 KB
testcase_12 AC 41 ms
53,460 KB
testcase_13 AC 45 ms
59,456 KB
testcase_14 AC 42 ms
53,460 KB
testcase_15 AC 50 ms
59,712 KB
testcase_16 AC 40 ms
53,460 KB
testcase_17 AC 49 ms
61,992 KB
testcase_18 AC 51 ms
61,992 KB
testcase_19 AC 51 ms
61,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

h, w = [int(x) for x in input().split()]
a = [input() for _ in range(h)]

cnt = [[[0] * 30 for _ in range(w)] for _ in range(h)]
cnt[0][0][1] = 1

for i in range(h):
	for j in range(w):
		for k in range(25):
			if i < h - 1:
				if a[i+1][j] == "o":
					cnt[i+1][j][k+1] += cnt[i][j][k]
				elif a[i+1][j] == "x" and k > 0:
					cnt[i+1][j][k-1] += cnt[i][j][k]
					
			if j < w - 1:
				if a[i][j+1] == "o":
					cnt[i][j+1][k+1] += cnt[i][j][k]
				elif a[i][j+1] == "x" and k > 0:
					cnt[i][j+1][k-1] += cnt[i][j][k]
					
print(sum(cnt[h-1][w-1]))
0