結果

問題 No.2225 Treasure Searching Rod (Easy)
ユーザー lloyzlloyz
提出日時 2023-02-24 21:53:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 147 ms / 2,000 ms
コード長 440 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 87,000 KB
実行使用メモリ 77,628 KB
最終ジャッジ日時 2023-10-11 06:10:54
合計ジャッジ時間 4,422 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
70,908 KB
testcase_01 AC 73 ms
70,728 KB
testcase_02 AC 74 ms
71,048 KB
testcase_03 AC 71 ms
70,944 KB
testcase_04 AC 71 ms
71,160 KB
testcase_05 AC 71 ms
71,080 KB
testcase_06 AC 72 ms
71,060 KB
testcase_07 AC 145 ms
77,392 KB
testcase_08 AC 144 ms
77,628 KB
testcase_09 AC 147 ms
77,592 KB
testcase_10 AC 126 ms
76,928 KB
testcase_11 AC 123 ms
77,048 KB
testcase_12 AC 143 ms
77,296 KB
testcase_13 AC 143 ms
77,508 KB
testcase_14 AC 145 ms
77,384 KB
testcase_15 AC 124 ms
76,976 KB
testcase_16 AC 122 ms
76,536 KB
testcase_17 AC 121 ms
76,824 KB
testcase_18 AC 121 ms
76,940 KB
testcase_19 AC 120 ms
77,032 KB
testcase_20 AC 122 ms
76,552 KB
testcase_21 AC 114 ms
76,532 KB
testcase_22 AC 73 ms
70,868 KB
testcase_23 AC 113 ms
76,928 KB
testcase_24 AC 117 ms
76,728 KB
testcase_25 AC 99 ms
76,204 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

h, w, k = map(int, input().split())
G = [[0 for _ in range(w)] for _ in range(h)]
for _ in range(k):
    x, y, v = map(int, input().split())
    G[x - 1][y - 1] += v
mod = 998244353

ans = 0
for i in range(h):
    for j in range(w):
        t = i - j
        for x in range(h):
            for y in range(0, min(x - t + 1, w)):
                if x + y >= i + j:
                    ans += G[x][y]
                    ans %= mod
print(ans)
0