結果

問題 No.1546 [Cherry 2nd Tune D] 思ったよりも易しくない
ユーザー titiatitia
提出日時 2021-06-11 21:44:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,396 ms / 2,000 ms
コード長 362 bytes
コンパイル時間 262 ms
コンパイル使用メモリ 86,724 KB
実行使用メモリ 103,984 KB
最終ジャッジ日時 2023-08-21 12:01:46
合計ジャッジ時間 46,772 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,152 KB
testcase_01 AC 71 ms
71,036 KB
testcase_02 AC 83 ms
70,860 KB
testcase_03 AC 73 ms
70,916 KB
testcase_04 AC 72 ms
71,016 KB
testcase_05 AC 70 ms
71,240 KB
testcase_06 AC 70 ms
71,080 KB
testcase_07 AC 71 ms
71,048 KB
testcase_08 AC 71 ms
71,176 KB
testcase_09 AC 71 ms
71,400 KB
testcase_10 AC 72 ms
70,912 KB
testcase_11 AC 71 ms
71,168 KB
testcase_12 AC 70 ms
71,088 KB
testcase_13 AC 532 ms
86,452 KB
testcase_14 AC 1,223 ms
101,172 KB
testcase_15 AC 711 ms
89,584 KB
testcase_16 AC 686 ms
89,316 KB
testcase_17 AC 516 ms
86,244 KB
testcase_18 AC 891 ms
94,212 KB
testcase_19 AC 822 ms
92,924 KB
testcase_20 AC 1,004 ms
96,180 KB
testcase_21 AC 122 ms
77,748 KB
testcase_22 AC 892 ms
94,276 KB
testcase_23 AC 755 ms
91,260 KB
testcase_24 AC 221 ms
80,008 KB
testcase_25 AC 1,277 ms
102,312 KB
testcase_26 AC 1,335 ms
103,624 KB
testcase_27 AC 669 ms
89,532 KB
testcase_28 AC 1,317 ms
103,668 KB
testcase_29 AC 1,325 ms
103,612 KB
testcase_30 AC 1,327 ms
103,600 KB
testcase_31 AC 1,327 ms
103,492 KB
testcase_32 AC 1,345 ms
103,672 KB
testcase_33 AC 1,323 ms
103,552 KB
testcase_34 AC 1,316 ms
103,576 KB
testcase_35 AC 1,322 ms
103,364 KB
testcase_36 AC 1,331 ms
103,668 KB
testcase_37 AC 1,329 ms
103,572 KB
testcase_38 AC 1,325 ms
103,624 KB
testcase_39 AC 1,327 ms
103,636 KB
testcase_40 AC 1,324 ms
103,544 KB
testcase_41 AC 1,396 ms
103,596 KB
testcase_42 AC 1,328 ms
103,508 KB
testcase_43 AC 1,291 ms
103,704 KB
testcase_44 AC 1,304 ms
103,984 KB
testcase_45 AC 1,295 ms
103,524 KB
testcase_46 AC 1,284 ms
103,420 KB
testcase_47 AC 1,300 ms
103,616 KB
testcase_48 AC 1,355 ms
103,664 KB
testcase_49 AC 1,313 ms
103,572 KB
testcase_50 AC 72 ms
71,048 KB
testcase_51 AC 71 ms
71,340 KB
testcase_52 AC 71 ms
71,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N=int(input())
mod=998244353

A=[tuple(map(int,input().split())) for i in range(N)]

SUM=0

for t,v in A:
    SUM+=t

NOW=1
ANS=0

def calc(k):
    return -(k*(k+1)//2)**2+k*(k+1)*(2*k+1)//6*SUM+k*(k+1)//2*(SUM+1)


for t,v in A:
    f=NOW
    l=NOW+t-1

    NOW+=t

    ANS+=v*(calc(l)-calc(f-1))

print(ANS//2%mod)

    
0