結果
問題 | No.2229 Treasure Searching Rod (Hard) |
ユーザー |
|
提出日時 | 2024-01-02 14:30:05 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 202 ms / 2,000 ms |
コード長 | 437 bytes |
コンパイル時間 | 294 ms |
コンパイル使用メモリ | 82,368 KB |
実行使用メモリ | 77,012 KB |
最終ジャッジ日時 | 2024-09-27 17:46:08 |
合計ジャッジ時間 | 7,504 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
h, w, k = map(int, input().split())mod = 998244353ans = 0inv2 = pow(2, mod - 2, mod)for _ in range(k):x, y, v = map(int, input().split())cnt = pow(x, 2, mod)if y < x:d = x - ycnt -= d * (d + 1) % mod * inv2 % modcnt %= modif (w - y) < x - 1:d = x - (w - y) - 1cnt -= d * (d + 1) % mod * inv2 % modcnt %= modans += v * cnt % modans %= modprint(ans)