結果

問題 No.1546 [Cherry 2nd Tune D] 思ったよりも易しくない
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-06-12 18:10:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 526 ms / 2,000 ms
コード長 442 bytes
コンパイル時間 1,413 ms
コンパイル使用メモリ 86,332 KB
実行使用メモリ 151,420 KB
最終ジャッジ日時 2023-08-22 15:55:46
合計ジャッジ時間 28,416 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,044 KB
testcase_01 AC 72 ms
71,388 KB
testcase_02 AC 72 ms
71,032 KB
testcase_03 AC 73 ms
71,240 KB
testcase_04 AC 71 ms
71,116 KB
testcase_05 AC 71 ms
71,224 KB
testcase_06 AC 70 ms
71,060 KB
testcase_07 AC 70 ms
71,352 KB
testcase_08 AC 72 ms
71,244 KB
testcase_09 AC 73 ms
71,140 KB
testcase_10 AC 71 ms
71,144 KB
testcase_11 AC 70 ms
71,144 KB
testcase_12 AC 72 ms
71,108 KB
testcase_13 AC 268 ms
103,316 KB
testcase_14 AC 526 ms
146,740 KB
testcase_15 AC 321 ms
111,668 KB
testcase_16 AC 278 ms
111,620 KB
testcase_17 AC 236 ms
101,532 KB
testcase_18 AC 355 ms
126,540 KB
testcase_19 AC 329 ms
121,760 KB
testcase_20 AC 377 ms
133,048 KB
testcase_21 AC 115 ms
78,024 KB
testcase_22 AC 363 ms
126,580 KB
testcase_23 AC 309 ms
116,472 KB
testcase_24 AC 148 ms
83,288 KB
testcase_25 AC 484 ms
149,328 KB
testcase_26 AC 514 ms
151,276 KB
testcase_27 AC 287 ms
111,684 KB
testcase_28 AC 479 ms
151,032 KB
testcase_29 AC 481 ms
150,984 KB
testcase_30 AC 482 ms
151,188 KB
testcase_31 AC 521 ms
151,024 KB
testcase_32 AC 489 ms
151,208 KB
testcase_33 AC 508 ms
150,868 KB
testcase_34 AC 489 ms
150,992 KB
testcase_35 AC 500 ms
151,244 KB
testcase_36 AC 480 ms
151,148 KB
testcase_37 AC 486 ms
151,112 KB
testcase_38 AC 472 ms
151,156 KB
testcase_39 AC 496 ms
151,088 KB
testcase_40 AC 487 ms
151,172 KB
testcase_41 AC 477 ms
150,840 KB
testcase_42 AC 478 ms
151,208 KB
testcase_43 AC 515 ms
151,036 KB
testcase_44 AC 467 ms
150,748 KB
testcase_45 AC 481 ms
151,204 KB
testcase_46 AC 468 ms
151,420 KB
testcase_47 AC 480 ms
151,028 KB
testcase_48 AC 506 ms
151,116 KB
testcase_49 AC 487 ms
151,216 KB
testcase_50 AC 70 ms
71,300 KB
testcase_51 AC 69 ms
71,084 KB
testcase_52 AC 69 ms
70,836 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
mod = 998244353

TV = [list(map(int,input().split())) for i in range(n)]
P = [1]
Q = [TV[0][0]]
s = TV[0][0]
for t,v in TV[1:]:
    P.append(Q[-1]+1)
    Q.append(Q[-1]+t)
    P[-1] %= mod
    Q[-1] %= mod
    s += t
    s %= mod
ans = 0
def f(x):
    return x*(x+1)*(x+2)*(4*s+3-3*x)%mod
inv = pow(24,mod-2,mod)
for i in range(n):
    v,p,q = TV[i][1],P[i],Q[i]
    ans += v*(f(q)-f(p-1))
    ans %= mod
print((ans*inv)%mod)
0