結果

問題 No.3112 区間和係数多項式?
ユーザー 👑 p-adicp-adic
提出日時 2024-02-05 16:44:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,691 ms / 6,000 ms
コード長 423 bytes
コンパイル時間 2,613 ms
コンパイル使用メモリ 81,444 KB
実行使用メモリ 401,020 KB
最終ジャッジ日時 2024-03-10 10:18:34
合計ジャッジ時間 30,354 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,460 KB
testcase_01 AC 35 ms
53,460 KB
testcase_02 AC 35 ms
53,460 KB
testcase_03 AC 35 ms
53,460 KB
testcase_04 AC 35 ms
53,460 KB
testcase_05 AC 36 ms
53,460 KB
testcase_06 AC 36 ms
53,460 KB
testcase_07 AC 39 ms
53,460 KB
testcase_08 AC 35 ms
53,460 KB
testcase_09 AC 36 ms
53,460 KB
testcase_10 AC 35 ms
53,460 KB
testcase_11 AC 37 ms
53,460 KB
testcase_12 AC 38 ms
53,460 KB
testcase_13 AC 55 ms
66,360 KB
testcase_14 AC 56 ms
68,468 KB
testcase_15 AC 58 ms
70,536 KB
testcase_16 AC 1,452 ms
401,020 KB
testcase_17 AC 1,888 ms
401,020 KB
testcase_18 AC 1,822 ms
401,020 KB
testcase_19 AC 1,836 ms
401,020 KB
testcase_20 AC 2,022 ms
401,020 KB
testcase_21 AC 2,265 ms
401,020 KB
testcase_22 AC 1,930 ms
401,020 KB
testcase_23 AC 1,735 ms
401,020 KB
testcase_24 AC 2,546 ms
401,020 KB
testcase_25 AC 2,691 ms
401,020 KB
testcase_26 AC 1,136 ms
401,020 KB
testcase_27 AC 1,113 ms
401,020 KB
testcase_28 AC 987 ms
401,020 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

R=range
J=lambda:map(int,input().split())
N,B,Q=J()
E,D=J()
A=[E]
for i in R(N-1):A+=[A[-1]*D%B]
F=[0]
for j in R(1,N):
	i=j-1
	F+=[A[j]]
	while i>j-(j&-j):
		F[j]+=F[i]
		i-=i&-i
i,r=J()
j,s=J()
x,t=J()
y,u=J()
for q in R(Q):
	k=i%N
	d=x-A[k]
	A[k]=x
	if k:
		while k<N:F[k],k=(F[k]+d)%B,k+(k&-k)
	else:E=(E+d)%B
	f=0
	p=1
	k=j%N
	while k:f,p,k=f+p*F[k],p*y%B,k-(k&-k)
	print((f+p*E)%B)
	i=i*r%N
	j=j*s%N
	x=x*t%B
	y=y*u%B
0