結果

問題 No.2229 Treasure Searching Rod (Hard)
ユーザー ニックネーム
提出日時 2023-02-24 22:42:45
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 1,182 ms / 2,000 ms
コード長 211 bytes
コンパイル時間 358 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-09-13 05:50:34
合計ジャッジ時間 23,041 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

h,w,k = map(int,input().split())
mod = 998244353; ans = 0
for _ in range(k):
    x,y,v = map(int,input().split())
    ans += ((max(x-y+1,1)+x)*min(x,y)//2+(x-1+max(x-w+y,1))*min(x-1,w-y)//2)*v%mod
print(ans%mod)
0