結果

問題 No.1546 [Cherry 2nd Tune D] 思ったよりも易しくない
ユーザー tassei903tassei903
提出日時 2021-06-11 22:34:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 483 ms / 2,000 ms
コード長 711 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 87,068 KB
実行使用メモリ 109,548 KB
最終ジャッジ日時 2023-08-21 13:14:09
合計ジャッジ時間 20,142 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,132 KB
testcase_01 AC 72 ms
71,232 KB
testcase_02 AC 72 ms
71,148 KB
testcase_03 AC 74 ms
71,260 KB
testcase_04 AC 72 ms
71,240 KB
testcase_05 AC 72 ms
71,180 KB
testcase_06 AC 73 ms
71,240 KB
testcase_07 AC 71 ms
71,168 KB
testcase_08 AC 74 ms
71,108 KB
testcase_09 AC 73 ms
71,176 KB
testcase_10 AC 72 ms
71,288 KB
testcase_11 AC 72 ms
71,176 KB
testcase_12 AC 71 ms
71,148 KB
testcase_13 AC 226 ms
88,860 KB
testcase_14 AC 418 ms
105,688 KB
testcase_15 AC 266 ms
92,656 KB
testcase_16 AC 264 ms
91,688 KB
testcase_17 AC 225 ms
87,996 KB
testcase_18 AC 325 ms
97,804 KB
testcase_19 AC 309 ms
95,872 KB
testcase_20 AC 362 ms
100,476 KB
testcase_21 AC 108 ms
77,936 KB
testcase_22 AC 325 ms
98,124 KB
testcase_23 AC 287 ms
94,212 KB
testcase_24 AC 138 ms
80,668 KB
testcase_25 AC 439 ms
107,148 KB
testcase_26 AC 447 ms
108,896 KB
testcase_27 AC 270 ms
92,112 KB
testcase_28 AC 461 ms
109,120 KB
testcase_29 AC 452 ms
108,968 KB
testcase_30 AC 454 ms
109,028 KB
testcase_31 AC 447 ms
109,012 KB
testcase_32 AC 454 ms
108,804 KB
testcase_33 AC 454 ms
109,180 KB
testcase_34 AC 451 ms
108,968 KB
testcase_35 AC 443 ms
109,036 KB
testcase_36 AC 463 ms
109,232 KB
testcase_37 AC 454 ms
108,992 KB
testcase_38 AC 461 ms
108,996 KB
testcase_39 AC 459 ms
108,972 KB
testcase_40 AC 447 ms
109,028 KB
testcase_41 AC 452 ms
109,044 KB
testcase_42 AC 458 ms
109,196 KB
testcase_43 AC 453 ms
109,048 KB
testcase_44 AC 450 ms
109,036 KB
testcase_45 AC 449 ms
108,972 KB
testcase_46 AC 434 ms
108,540 KB
testcase_47 AC 452 ms
109,548 KB
testcase_48 AC 483 ms
108,728 KB
testcase_49 AC 448 ms
108,972 KB
testcase_50 AC 72 ms
71,248 KB
testcase_51 AC 72 ms
71,240 KB
testcase_52 AC 72 ms
70,916 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
sys.setrecursionlimit(10**7)
yes = lambda :print("yes");Yes = lambda :print("Yes")
no = lambda :print("no");No = lambda :print("No")
#######################################################################


n = ni()
s = 0
ans = 0
m = 998244353
m24 = pow(24,m-2,m)
tv = [na() for i in range(n)]
N=0
for i in range(n):
    N+=tv[i][0]
def g(x,y):
    return x*y%m
def f(x):
    return g(g(g(g(x,x-1),x+1),4*N-3*x+6),m24)

for i in range(n):
    #print((f(s+tv[i][0]+1)-f(s))%m)
    ans+=g(tv[i][1],(f(s+tv[i][0]+1)-f(s+1))%m)%m
    ans%=m
    s+=tv[i][0]
    s%=m
    #print(s)

print(ans)
0