結果

問題 No.2229 Treasure Searching Rod (Hard)
ユーザー 👑 timitimi
提出日時 2023-03-07 21:56:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 211 ms / 2,000 ms
コード長 230 bytes
コンパイル時間 210 ms
コンパイル使用メモリ 81,916 KB
実行使用メモリ 76,956 KB
最終ジャッジ日時 2023-10-18 05:36:28
合計ジャッジ時間 6,814 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,376 KB
testcase_01 AC 37 ms
53,376 KB
testcase_02 AC 37 ms
53,376 KB
testcase_03 AC 37 ms
53,376 KB
testcase_04 AC 37 ms
53,376 KB
testcase_05 AC 37 ms
53,376 KB
testcase_06 AC 37 ms
53,376 KB
testcase_07 AC 184 ms
76,008 KB
testcase_08 AC 189 ms
76,032 KB
testcase_09 AC 178 ms
75,752 KB
testcase_10 AC 186 ms
76,008 KB
testcase_11 AC 211 ms
76,956 KB
testcase_12 AC 136 ms
76,016 KB
testcase_13 AC 120 ms
75,684 KB
testcase_14 AC 142 ms
76,036 KB
testcase_15 AC 182 ms
75,756 KB
testcase_16 AC 180 ms
75,740 KB
testcase_17 AC 180 ms
75,752 KB
testcase_18 AC 178 ms
75,740 KB
testcase_19 AC 179 ms
75,752 KB
testcase_20 AC 180 ms
75,748 KB
testcase_21 AC 181 ms
75,740 KB
testcase_22 AC 181 ms
75,740 KB
testcase_23 AC 113 ms
75,740 KB
testcase_24 AC 124 ms
75,688 KB
testcase_25 AC 132 ms
75,688 KB
testcase_26 AC 99 ms
75,736 KB
testcase_27 AC 81 ms
75,704 KB
testcase_28 AC 159 ms
75,704 KB
testcase_29 AC 158 ms
75,756 KB
testcase_30 AC 83 ms
75,684 KB
testcase_31 AC 92 ms
75,708 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0