結果

問題 No.2229 Treasure Searching Rod (Hard)
コンテスト
ユーザー flygon
提出日時 2023-02-24 23:51:44
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 185 ms / 2,000 ms
+ 886µs
コード長 362 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 232 ms
コンパイル使用メモリ 95,980 KB
実行使用メモリ 100,352 KB
最終ジャッジ日時 2026-08-25 23:40:31
合計ジャッジ時間 7,608 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

h,w,k = map(int,input().split())
ans = 0
mod =998244353
now = 1
xx = [0]
for i in range(2*10**5):
  xx.append(xx[-1] + now)
  now += 2
  now %= mod
for i in range(k):
  x,y,v = map(int,input().split())
  cnt = xx[x]
  lcnt = max(0,x-y)
  rcnt = max(0, x-(w-y+1))
  cnt -= lcnt*(lcnt+1)//2 + rcnt*(rcnt+1)//2
  cnt %= mod
  ans += v * cnt
  ans %= mod

print(ans)
0