結果

問題 No.2229 Treasure Searching Rod (Hard)
ユーザー flygonflygon
提出日時 2023-02-24 23:51:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 254 ms / 2,000 ms
コード長 362 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 87,156 KB
実行使用メモリ 93,200 KB
最終ジャッジ日時 2023-10-11 07:03:14
合計ジャッジ時間 7,923 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
89,940 KB
testcase_01 AC 87 ms
89,872 KB
testcase_02 AC 88 ms
89,800 KB
testcase_03 AC 92 ms
89,992 KB
testcase_04 AC 88 ms
89,836 KB
testcase_05 AC 89 ms
90,052 KB
testcase_06 AC 86 ms
89,888 KB
testcase_07 AC 231 ms
90,672 KB
testcase_08 AC 233 ms
93,200 KB
testcase_09 AC 221 ms
90,792 KB
testcase_10 AC 228 ms
90,816 KB
testcase_11 AC 254 ms
90,720 KB
testcase_12 AC 183 ms
90,932 KB
testcase_13 AC 165 ms
90,552 KB
testcase_14 AC 182 ms
90,552 KB
testcase_15 AC 233 ms
90,808 KB
testcase_16 AC 231 ms
90,744 KB
testcase_17 AC 231 ms
90,828 KB
testcase_18 AC 239 ms
90,620 KB
testcase_19 AC 234 ms
90,996 KB
testcase_20 AC 235 ms
90,832 KB
testcase_21 AC 235 ms
90,828 KB
testcase_22 AC 237 ms
90,816 KB
testcase_23 AC 160 ms
91,040 KB
testcase_24 AC 169 ms
90,768 KB
testcase_25 AC 184 ms
90,708 KB
testcase_26 AC 151 ms
90,792 KB
testcase_27 AC 132 ms
91,068 KB
testcase_28 AC 211 ms
90,948 KB
testcase_29 AC 209 ms
90,768 KB
testcase_30 AC 132 ms
90,864 KB
testcase_31 AC 145 ms
90,740 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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