結果
問題 | No.2229 Treasure Searching Rod (Hard) |
ユーザー | Kude |
提出日時 | 2023-02-24 21:46:45 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 186 ms / 2,000 ms |
コード長 | 351 bytes |
コンパイル時間 | 354 ms |
コンパイル使用メモリ | 82,404 KB |
実行使用メモリ | 76,624 KB |
最終ジャッジ日時 | 2024-09-13 05:19:07 |
合計ジャッジ時間 | 5,959 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
h, w, k = map(int, input().split()) ans = 0 for _ in range(k): x, y, v = map(int, input().split()) x -= 1 y -= 1 s = 0 s += (x + 1) ** 2 x1 = x - y - 1 if x1 >= 0: s -= (x1 + 1) * (x1 + 2) // 2 x2 = x - (w - y) if x2 >= 0: s -= (x2 + 1) * (x2 + 2) // 2 ans = (ans + s * v) % 998244353 print(ans)