結果

問題 No.2229 Treasure Searching Rod (Hard)
ユーザー KudeKude
提出日時 2023-02-24 21:37:27
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 517 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 86,876 KB
実行使用メモリ 838,032 KB
最終ジャッジ日時 2023-10-11 05:58:27
合計ジャッジ時間 4,255 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,456 KB
testcase_01 AC 76 ms
71,152 KB
testcase_02 AC 75 ms
71,240 KB
testcase_03 AC 75 ms
71,284 KB
testcase_04 AC 76 ms
71,404 KB
testcase_05 AC 75 ms
71,472 KB
testcase_06 AC 74 ms
71,472 KB
testcase_07 MLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

h, w, k = map(int, input().split())
w2 = 2 * w
d = [[0] * w2 for _ in range(h)]
for _ in range(k):
    x, y, v = map(int, input().split())
    d[x-1][w + y-1] = v
for i in range(1, h)[::-1]:
    for j in range(1, w2)[::-1]:
        d[i-1][j-1] += d[i][j]
for i in range(1, h)[::-1]:
    for j in range(w2 - 1):
        d[i-1][j+1] += d[i][j]
ans = 0
for i in range(h):
    for j in range(w):
        ans += d[i][w + j]
        if i + 1 < h:
            ans += d[i+1][w + j]
    ans %= 998244353
print(ans % 998244353)
0