結果
問題 |
No.2229 Treasure Searching Rod (Hard)
|
ユーザー |
![]() |
提出日時 | 2023-03-07 21:56:58 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 197 ms / 2,000 ms |
コード長 | 230 bytes |
コンパイル時間 | 191 ms |
コンパイル使用メモリ | 82,152 KB |
実行使用メモリ | 77,696 KB |
最終ジャッジ日時 | 2024-09-18 02:14:31 |
合計ジャッジ時間 | 6,024 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
H,W,N=map(int, input().split()) ans=0 mod=998244353 for i in range(N): h,w,p=map(int, input().split()) c=(1+2*h-1)*h//2 l=max(h-w,0) r=max(h-(W-w+1),0) ll,rr=l*(l+1)//2,r*(r+1)//2 ans+=(c-ll-rr)*p ans%=mod print(ans)