結果

問題 No.1546 [Cherry 2nd Tune D] 思ったよりも易しくない
ユーザー roarisroaris
提出日時 2021-06-11 22:55:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,501 ms / 2,000 ms
コード長 390 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 97,516 KB
最終ジャッジ日時 2024-04-29 08:15:52
合計ジャッジ時間 52,414 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
51,840 KB
testcase_01 AC 41 ms
52,096 KB
testcase_02 AC 40 ms
51,968 KB
testcase_03 AC 43 ms
52,480 KB
testcase_04 AC 42 ms
52,352 KB
testcase_05 AC 41 ms
51,584 KB
testcase_06 AC 40 ms
51,968 KB
testcase_07 AC 41 ms
52,096 KB
testcase_08 AC 41 ms
52,352 KB
testcase_09 AC 42 ms
52,352 KB
testcase_10 AC 43 ms
52,736 KB
testcase_11 AC 41 ms
52,224 KB
testcase_12 AC 42 ms
52,992 KB
testcase_13 AC 577 ms
81,552 KB
testcase_14 AC 1,343 ms
93,064 KB
testcase_15 AC 731 ms
83,616 KB
testcase_16 AC 709 ms
83,748 KB
testcase_17 AC 542 ms
81,676 KB
testcase_18 AC 988 ms
86,576 KB
testcase_19 AC 910 ms
85,400 KB
testcase_20 AC 1,106 ms
89,140 KB
testcase_21 AC 106 ms
76,160 KB
testcase_22 AC 1,010 ms
86,452 KB
testcase_23 AC 823 ms
83,856 KB
testcase_24 AC 216 ms
77,440 KB
testcase_25 AC 1,420 ms
93,576 KB
testcase_26 AC 1,471 ms
96,256 KB
testcase_27 AC 728 ms
83,364 KB
testcase_28 AC 1,469 ms
96,508 KB
testcase_29 AC 1,467 ms
96,260 KB
testcase_30 AC 1,470 ms
96,008 KB
testcase_31 AC 1,489 ms
96,516 KB
testcase_32 AC 1,470 ms
95,876 KB
testcase_33 AC 1,464 ms
96,256 KB
testcase_34 AC 1,468 ms
96,616 KB
testcase_35 AC 1,457 ms
96,140 KB
testcase_36 AC 1,456 ms
96,640 KB
testcase_37 AC 1,467 ms
96,260 KB
testcase_38 AC 1,466 ms
96,640 KB
testcase_39 AC 1,464 ms
96,140 KB
testcase_40 AC 1,468 ms
96,512 KB
testcase_41 AC 1,461 ms
96,128 KB
testcase_42 AC 1,457 ms
96,388 KB
testcase_43 AC 1,392 ms
96,184 KB
testcase_44 AC 1,391 ms
96,316 KB
testcase_45 AC 1,399 ms
96,440 KB
testcase_46 AC 1,385 ms
96,228 KB
testcase_47 AC 1,389 ms
96,696 KB
testcase_48 AC 1,501 ms
97,516 KB
testcase_49 AC 1,457 ms
96,516 KB
testcase_50 AC 42 ms
51,712 KB
testcase_51 AC 41 ms
51,968 KB
testcase_52 AC 40 ms
51,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

def f(a, b):
    return (3*a**4-2*a**3*(2*S+3)-3*a**2+a*(4*S+6)-b*(b**2+3*b+2)*(3*b-4*S-3))//24

N = int(input())
S = 0
TV = []

for _ in range(N):
    T, V = map(int, input().split())
    S += T
    TV.append((T, V))

ans = 0
acc = 1
MOD = 998244353

for T, V in TV:
    ans += f(acc, acc+T-1)*V
    ans %= MOD
    acc += T
    acc %= MOD

print(ans)
0