結果

問題 No.1546 [Cherry 2nd Tune D] 思ったよりも易しくない
ユーザー 👑 KazunKazun
提出日時 2021-03-20 02:52:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 324 ms / 2,000 ms
コード長 451 bytes
コンパイル時間 744 ms
コンパイル使用メモリ 86,620 KB
実行使用メモリ 87,096 KB
最終ジャッジ日時 2023-08-21 09:19:39
合計ジャッジ時間 15,635 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
71,364 KB
testcase_01 AC 80 ms
71,096 KB
testcase_02 AC 82 ms
71,372 KB
testcase_03 AC 80 ms
71,280 KB
testcase_04 AC 80 ms
71,048 KB
testcase_05 AC 79 ms
71,032 KB
testcase_06 AC 79 ms
71,232 KB
testcase_07 AC 80 ms
70,888 KB
testcase_08 AC 81 ms
70,940 KB
testcase_09 AC 81 ms
70,788 KB
testcase_10 AC 80 ms
70,892 KB
testcase_11 AC 79 ms
71,216 KB
testcase_12 AC 81 ms
71,056 KB
testcase_13 AC 178 ms
80,360 KB
testcase_14 AC 276 ms
85,776 KB
testcase_15 AC 191 ms
81,548 KB
testcase_16 AC 190 ms
81,356 KB
testcase_17 AC 166 ms
80,336 KB
testcase_18 AC 226 ms
83,236 KB
testcase_19 AC 211 ms
82,532 KB
testcase_20 AC 242 ms
84,164 KB
testcase_21 AC 95 ms
77,176 KB
testcase_22 AC 228 ms
83,324 KB
testcase_23 AC 199 ms
82,220 KB
testcase_24 AC 118 ms
78,172 KB
testcase_25 AC 289 ms
86,460 KB
testcase_26 AC 286 ms
86,772 KB
testcase_27 AC 192 ms
81,340 KB
testcase_28 AC 296 ms
86,752 KB
testcase_29 AC 286 ms
86,720 KB
testcase_30 AC 293 ms
86,792 KB
testcase_31 AC 292 ms
86,640 KB
testcase_32 AC 292 ms
86,660 KB
testcase_33 AC 294 ms
86,620 KB
testcase_34 AC 292 ms
86,744 KB
testcase_35 AC 293 ms
86,708 KB
testcase_36 AC 295 ms
86,704 KB
testcase_37 AC 299 ms
86,720 KB
testcase_38 AC 291 ms
86,772 KB
testcase_39 AC 294 ms
86,656 KB
testcase_40 AC 292 ms
86,720 KB
testcase_41 AC 290 ms
86,972 KB
testcase_42 AC 295 ms
86,708 KB
testcase_43 AC 283 ms
87,096 KB
testcase_44 AC 284 ms
86,764 KB
testcase_45 AC 284 ms
86,564 KB
testcase_46 AC 277 ms
86,592 KB
testcase_47 AC 282 ms
86,908 KB
testcase_48 AC 324 ms
86,632 KB
testcase_49 AC 292 ms
86,596 KB
testcase_50 AC 82 ms
71,224 KB
testcase_51 AC 81 ms
71,264 KB
testcase_52 AC 82 ms
71,156 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=sys.stdin.readline

N=int(input())

T=[0]*N
V=[0]*N
Mod=998244353
for i in range(N):
    T[i],V[i]=map(int,input().split())

P=[0]*N
Q=[0]*N

P[0]=1
Q[0]=T[0]

for i in range(1,N):
    P[i]=Q[i-1]+1
    Q[i]=P[i]+T[i]-1

    P[i]%=Mod
    Q[i]%=Mod

M=sum(T)%Mod

twenty_four_inv=pow(24,Mod-2,Mod)
S=lambda b:b*(b+1)*(b+2)*(4*M+3-3*b)%Mod

X=0
for v,p,q in zip(V,P,Q):
    X+=v*(S(q)-S(p-1))
    X%=Mod

print((twenty_four_inv*X)%Mod)
0