結果
問題 | No.2708 Jewel holder |
ユーザー | N_noa21 |
提出日時 | 2024-03-31 19:34:08 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 54 ms / 2,000 ms |
コード長 | 698 bytes |
コンパイル時間 | 256 ms |
コンパイル使用メモリ | 81,700 KB |
実行使用メモリ | 64,096 KB |
最終ジャッジ日時 | 2024-03-31 19:34:11 |
合計ジャッジ時間 | 1,988 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 38 ms
53,460 KB |
testcase_01 | AC | 39 ms
53,460 KB |
testcase_02 | AC | 39 ms
53,460 KB |
testcase_03 | AC | 37 ms
53,460 KB |
testcase_04 | AC | 38 ms
53,460 KB |
testcase_05 | AC | 37 ms
53,460 KB |
testcase_06 | AC | 37 ms
53,460 KB |
testcase_07 | AC | 46 ms
62,000 KB |
testcase_08 | AC | 50 ms
62,000 KB |
testcase_09 | AC | 52 ms
64,080 KB |
testcase_10 | AC | 49 ms
64,088 KB |
testcase_11 | AC | 50 ms
64,096 KB |
testcase_12 | AC | 43 ms
59,840 KB |
testcase_13 | AC | 50 ms
64,096 KB |
testcase_14 | AC | 49 ms
61,988 KB |
testcase_15 | AC | 54 ms
64,076 KB |
testcase_16 | AC | 46 ms
62,000 KB |
testcase_17 | AC | 52 ms
64,092 KB |
testcase_18 | AC | 52 ms
64,092 KB |
testcase_19 | AC | 54 ms
64,092 KB |
ソースコード
H,W = map(int, input().split()) A = [list(input()) for i in range(H)] dp = [[[0]*W for i in range(H)] for j in range(100)] dp[1][0][0] = 1 for h in range(H): for w in range(W): for je in reversed(range(100)): if h == 0 and w == 0: continue if A[h][w] == "o": tmp = 1 elif A[h][w] == "x": tmp = -1 else: continue if 0<=je-tmp<100: if h>0: dp[je][h][w] += dp[je-tmp][h-1][w] if w>0: dp[je][h][w] += dp[je-tmp][h][w-1] ans = 0 for k in range(100): ans += dp[k][-1][-1] print(ans)