結果

問題 No.2229 Treasure Searching Rod (Hard)
ユーザー ああいいああいい
提出日時 2023-02-25 16:38:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 233 ms / 2,000 ms
コード長 374 bytes
コンパイル時間 833 ms
コンパイル使用メモリ 86,880 KB
実行使用メモリ 77,800 KB
最終ジャッジ日時 2023-10-11 14:18:36
合計ジャッジ時間 8,288 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,404 KB
testcase_01 AC 73 ms
71,408 KB
testcase_02 AC 72 ms
71,176 KB
testcase_03 AC 72 ms
71,064 KB
testcase_04 AC 73 ms
71,060 KB
testcase_05 AC 73 ms
71,404 KB
testcase_06 AC 73 ms
71,412 KB
testcase_07 AC 230 ms
77,564 KB
testcase_08 AC 223 ms
77,740 KB
testcase_09 AC 213 ms
77,800 KB
testcase_10 AC 216 ms
77,728 KB
testcase_11 AC 233 ms
77,688 KB
testcase_12 AC 154 ms
77,508 KB
testcase_13 AC 153 ms
77,240 KB
testcase_14 AC 155 ms
77,144 KB
testcase_15 AC 215 ms
77,524 KB
testcase_16 AC 213 ms
77,620 KB
testcase_17 AC 213 ms
77,560 KB
testcase_18 AC 214 ms
77,660 KB
testcase_19 AC 213 ms
77,536 KB
testcase_20 AC 216 ms
77,664 KB
testcase_21 AC 214 ms
77,532 KB
testcase_22 AC 215 ms
77,468 KB
testcase_23 AC 145 ms
77,548 KB
testcase_24 AC 159 ms
77,152 KB
testcase_25 AC 166 ms
77,632 KB
testcase_26 AC 135 ms
77,468 KB
testcase_27 AC 116 ms
77,652 KB
testcase_28 AC 191 ms
77,764 KB
testcase_29 AC 190 ms
77,472 KB
testcase_30 AC 116 ms
77,376 KB
testcase_31 AC 129 ms
77,308 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

H,W,K = map(int,input().split())
P = 998244353

def calc(x,y):
    ans = 0
    if x >= y:
        ans += (y * y + y) // 2
        ans += y * (x - y)
    else:
        ans += (x * x + x) // 2
    return ans
ans = 0
for _ in range(K):
    x,y,v = map(int,input().split())
    tmp = 0
    tmp += calc(x,y) + calc(x,W - y + 1) - x
    ans += tmp * v % P
    ans %= P
print(ans)
0