結果

問題 No.2225 Treasure Searching Rod (Easy)
ユーザー tamatotamato
提出日時 2023-02-24 21:24:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 137 ms / 2,000 ms
コード長 566 bytes
コンパイル時間 369 ms
コンパイル使用メモリ 87,048 KB
実行使用メモリ 77,200 KB
最終ジャッジ日時 2023-10-11 05:45:56
合計ジャッジ時間 4,395 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,308 KB
testcase_01 AC 73 ms
71,364 KB
testcase_02 AC 74 ms
71,276 KB
testcase_03 AC 75 ms
71,300 KB
testcase_04 AC 74 ms
71,312 KB
testcase_05 AC 74 ms
71,452 KB
testcase_06 AC 75 ms
71,144 KB
testcase_07 AC 136 ms
77,004 KB
testcase_08 AC 136 ms
77,200 KB
testcase_09 AC 136 ms
77,152 KB
testcase_10 AC 131 ms
76,688 KB
testcase_11 AC 132 ms
76,764 KB
testcase_12 AC 136 ms
76,812 KB
testcase_13 AC 137 ms
77,200 KB
testcase_14 AC 136 ms
76,992 KB
testcase_15 AC 130 ms
76,624 KB
testcase_16 AC 130 ms
76,684 KB
testcase_17 AC 130 ms
76,936 KB
testcase_18 AC 129 ms
76,436 KB
testcase_19 AC 128 ms
76,760 KB
testcase_20 AC 130 ms
77,024 KB
testcase_21 AC 100 ms
76,704 KB
testcase_22 AC 75 ms
70,992 KB
testcase_23 AC 100 ms
76,688 KB
testcase_24 AC 108 ms
76,828 KB
testcase_25 AC 90 ms
76,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 998244353


def main():
    import sys
    input = sys.stdin.readline

    H, W, K = map(int, input().split())
    G = [[0] * W for _ in range(H)]
    for _ in range(K):
        h, w, v = map(int, input().split())
        G[h-1][w-1] = v

    ans = 0
    for h0 in range(H):
        for w0 in range(W):
            for h in range(H):
                for w in range(W):
                    if h + w >= h0 + w0 and h - w >= h0 - w0:
                        ans += G[h][w]
                        ans %= mod
    print(ans)


if __name__ == '__main__':
    main()
0