結果

問題 No.1546 [Cherry 2nd Tune D] 思ったよりも易しくない
ユーザー titiatitia
提出日時 2021-06-11 21:44:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,236 ms / 2,000 ms
コード長 362 bytes
コンパイル時間 221 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 102,912 KB
最終ジャッジ日時 2024-05-08 17:21:57
合計ジャッジ時間 41,322 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
51,712 KB
testcase_01 AC 42 ms
51,840 KB
testcase_02 AC 38 ms
51,840 KB
testcase_03 AC 37 ms
52,864 KB
testcase_04 AC 38 ms
52,480 KB
testcase_05 AC 37 ms
51,840 KB
testcase_06 AC 38 ms
51,840 KB
testcase_07 AC 37 ms
52,224 KB
testcase_08 AC 38 ms
52,352 KB
testcase_09 AC 43 ms
52,352 KB
testcase_10 AC 39 ms
52,608 KB
testcase_11 AC 43 ms
51,968 KB
testcase_12 AC 40 ms
53,120 KB
testcase_13 AC 475 ms
85,760 KB
testcase_14 AC 1,105 ms
100,480 KB
testcase_15 AC 617 ms
88,576 KB
testcase_16 AC 596 ms
88,448 KB
testcase_17 AC 459 ms
85,248 KB
testcase_18 AC 796 ms
93,568 KB
testcase_19 AC 745 ms
92,288 KB
testcase_20 AC 892 ms
95,744 KB
testcase_21 AC 99 ms
77,056 KB
testcase_22 AC 803 ms
93,184 KB
testcase_23 AC 680 ms
90,368 KB
testcase_24 AC 186 ms
78,976 KB
testcase_25 AC 1,157 ms
101,504 KB
testcase_26 AC 1,195 ms
102,528 KB
testcase_27 AC 599 ms
88,448 KB
testcase_28 AC 1,198 ms
102,528 KB
testcase_29 AC 1,189 ms
102,400 KB
testcase_30 AC 1,194 ms
102,400 KB
testcase_31 AC 1,196 ms
102,400 KB
testcase_32 AC 1,210 ms
102,400 KB
testcase_33 AC 1,215 ms
102,912 KB
testcase_34 AC 1,216 ms
102,400 KB
testcase_35 AC 1,204 ms
102,656 KB
testcase_36 AC 1,192 ms
102,400 KB
testcase_37 AC 1,203 ms
102,528 KB
testcase_38 AC 1,204 ms
102,400 KB
testcase_39 AC 1,204 ms
102,400 KB
testcase_40 AC 1,198 ms
102,656 KB
testcase_41 AC 1,209 ms
102,400 KB
testcase_42 AC 1,204 ms
102,400 KB
testcase_43 AC 1,165 ms
102,528 KB
testcase_44 AC 1,178 ms
102,528 KB
testcase_45 AC 1,170 ms
102,528 KB
testcase_46 AC 1,148 ms
102,528 KB
testcase_47 AC 1,173 ms
102,784 KB
testcase_48 AC 1,236 ms
102,400 KB
testcase_49 AC 1,214 ms
102,528 KB
testcase_50 AC 38 ms
52,224 KB
testcase_51 AC 37 ms
52,096 KB
testcase_52 AC 36 ms
51,712 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