結果

問題 No.2578 Jewelry Store
ユーザー 👑 p-adicp-adic
提出日時 2023-12-07 16:29:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 822 bytes
コンパイル時間 227 ms
コンパイル使用メモリ 12,160 KB
実行使用メモリ 17,044 KB
最終ジャッジ日時 2023-12-07 16:29:23
合計ジャッジ時間 18,606 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,368 KB
testcase_01 AC 29 ms
10,368 KB
testcase_02 AC 632 ms
10,368 KB
testcase_03 AC 177 ms
10,368 KB
testcase_04 AC 3,056 ms
10,368 KB
testcase_05 AC 58 ms
10,368 KB
testcase_06 AC 615 ms
10,368 KB
testcase_07 AC 3,133 ms
10,368 KB
testcase_08 AC 178 ms
10,368 KB
testcase_09 AC 3,061 ms
10,368 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.py:33: SyntaxWarning: invalid decimal literal
  s=[1-len([1for i in R(L)if d>>i&1])%2*2for d in R(U)]
Main.py:33: SyntaxWarning: invalid decimal literal
  s=[1-len([1for i in R(L)if d>>i&1])%2*2for d in R(U)]

ソースコード

diff #

R=range
I=lambda:map(int,input().split())
T,m=I()
P,n=set(),m
for i in R(2,min(m+1,31623)):
	if n%i<1:P.add(i)
	while n%i<1:n//=i
M=[n]*(n>1)
def G(a,b):
	while a:a,b=b%a,a
	return b
def r(n):
	for j in R(len(M)):
		while M[j]%n<1:M[j]//=n
	P.add(n)
while M:
	n=M.pop()
	c=int(n**0.25)*9
	if n<10**9:r(n)
	else:
		while c:
			x,d=c,1
			y=(x*x+1)%n
			while (d<2)*c:x,y,d,c=(x*x+1)%n,(y**4+2*y*y+2)%n,G(abs(x-y),n),c-1
			if d<n and c:
				M+=[n//d,d]
				break
		else:r(n)
P=list(P)
L=len(P)
Q=998244353
U=1<<L
s=[1-len([1for i in R(L)if d>>i&1])%2*2for d in R(U)]
for t in R(T):
	N,B,C,D=I()
	c=[1]*U
	for a in I():
		b=0
		for i in R(L):b|=(m//a%P[i]<1)<<i
		c[b],B=c[b]*(1+B*(m%a<1))%Q,(C*B+D)%Q
	for i in R(L):
		for d in R(U):
			if d>>i&1<1:c[d]=c[d]*c[d|1<<i]%Q
	v=0
	for d in R(U):v+=c[d]*s[d]
	print((v-(m<2))%Q)
0