結果

問題 No.2225 Treasure Searching Rod (Easy)
ユーザー FromBooskaFromBooska
提出日時 2023-03-05 10:43:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 189 ms / 2,000 ms
コード長 615 bytes
コンパイル時間 453 ms
コンパイル使用メモリ 81,876 KB
実行使用メモリ 75,936 KB
最終ジャッジ日時 2023-10-18 04:49:03
合計ジャッジ時間 3,899 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,452 KB
testcase_01 AC 38 ms
53,452 KB
testcase_02 AC 37 ms
53,452 KB
testcase_03 AC 37 ms
53,452 KB
testcase_04 AC 38 ms
53,452 KB
testcase_05 AC 37 ms
53,452 KB
testcase_06 AC 39 ms
53,452 KB
testcase_07 AC 189 ms
75,932 KB
testcase_08 AC 119 ms
75,936 KB
testcase_09 AC 127 ms
75,936 KB
testcase_10 AC 95 ms
70,348 KB
testcase_11 AC 97 ms
72,428 KB
testcase_12 AC 126 ms
75,936 KB
testcase_13 AC 127 ms
75,936 KB
testcase_14 AC 127 ms
75,936 KB
testcase_15 AC 102 ms
70,348 KB
testcase_16 AC 101 ms
70,348 KB
testcase_17 AC 100 ms
70,348 KB
testcase_18 AC 100 ms
70,348 KB
testcase_19 AC 101 ms
70,348 KB
testcase_20 AC 101 ms
70,348 KB
testcase_21 AC 76 ms
70,344 KB
testcase_22 AC 39 ms
53,456 KB
testcase_23 AC 74 ms
70,420 KB
testcase_24 AC 75 ms
68,300 KB
testcase_25 AC 60 ms
66,232 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# 制約が大きければ寄与度か
# まずナイーブにやってみる
# H, W <50なので4重ループでも問題ないはず

mod = 998244353
H, W, K = map(int, input().split())
grid = [[0]*W for i in range(H)]
for i in range(K):
    x, y, v = map(int, input().split())
    grid[x-1][y-1] = v

calc = 0
for i in range(H):
    for j in range(W):
        subcalc = 0
        for x in range(H):
            for y in range(W):
                if x+y >= i+j and x-y >= i-j:
                    subcalc += grid[x][y]
                    subcalc %= mod
        calc += subcalc
        calc %= mod
print(calc%mod)
0