結果

問題 No.1546 [Cherry 2nd Tune D] 思ったよりも易しくない
ユーザー hir355hir355
提出日時 2021-06-11 21:48:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 594 ms / 2,000 ms
コード長 339 bytes
コンパイル時間 425 ms
コンパイル使用メモリ 87,232 KB
実行使用メモリ 82,984 KB
最終ジャッジ日時 2023-08-21 12:08:14
合計ジャッジ時間 23,677 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,280 KB
testcase_01 AC 71 ms
71,348 KB
testcase_02 AC 73 ms
71,348 KB
testcase_03 AC 74 ms
71,480 KB
testcase_04 AC 74 ms
71,196 KB
testcase_05 AC 73 ms
71,392 KB
testcase_06 AC 73 ms
71,428 KB
testcase_07 AC 72 ms
71,296 KB
testcase_08 AC 72 ms
71,356 KB
testcase_09 AC 72 ms
71,160 KB
testcase_10 AC 71 ms
71,156 KB
testcase_11 AC 73 ms
71,164 KB
testcase_12 AC 74 ms
71,448 KB
testcase_13 AC 275 ms
79,296 KB
testcase_14 AC 526 ms
81,996 KB
testcase_15 AC 329 ms
80,336 KB
testcase_16 AC 320 ms
79,988 KB
testcase_17 AC 264 ms
79,428 KB
testcase_18 AC 409 ms
81,216 KB
testcase_19 AC 384 ms
80,496 KB
testcase_20 AC 447 ms
81,060 KB
testcase_21 AC 120 ms
77,612 KB
testcase_22 AC 408 ms
80,780 KB
testcase_23 AC 359 ms
80,200 KB
testcase_24 AC 158 ms
78,108 KB
testcase_25 AC 548 ms
82,240 KB
testcase_26 AC 560 ms
82,172 KB
testcase_27 AC 326 ms
80,200 KB
testcase_28 AC 573 ms
82,608 KB
testcase_29 AC 569 ms
82,528 KB
testcase_30 AC 568 ms
82,520 KB
testcase_31 AC 572 ms
82,436 KB
testcase_32 AC 569 ms
82,252 KB
testcase_33 AC 566 ms
82,680 KB
testcase_34 AC 568 ms
82,764 KB
testcase_35 AC 570 ms
82,392 KB
testcase_36 AC 570 ms
82,540 KB
testcase_37 AC 566 ms
82,260 KB
testcase_38 AC 566 ms
82,984 KB
testcase_39 AC 568 ms
82,588 KB
testcase_40 AC 566 ms
82,596 KB
testcase_41 AC 567 ms
82,532 KB
testcase_42 AC 569 ms
82,536 KB
testcase_43 AC 543 ms
82,372 KB
testcase_44 AC 541 ms
82,376 KB
testcase_45 AC 538 ms
82,420 KB
testcase_46 AC 557 ms
82,380 KB
testcase_47 AC 539 ms
82,364 KB
testcase_48 AC 594 ms
82,516 KB
testcase_49 AC 564 ms
82,248 KB
testcase_50 AC 71 ms
71,316 KB
testcase_51 AC 71 ms
71,188 KB
testcase_52 AC 72 ms
71,272 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353
n = int(input())
t = [0] * n
v = [0] * n
for i in range(n):
    t[i], v[i] = map(int, input().split())
l = sum(t)
v24 = pow(24, MOD - 2, MOD)

def f(k):
    return k * (k + 1) * (k + 2) * (4 * l - 3 * k + 3) * v24 % MOD

ans = 0
p = 0
for i in range(n):
    ans += (f(p + t[i]) - f(p)) * v[i]
    p += t[i]
print(ans % MOD)
0