結果

問題 No.2578 Jewelry Store
ユーザー 👑 p-adicp-adic
提出日時 2023-12-07 14:15:57
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 741 bytes
コンパイル時間 220 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 120,056 KB
最終ジャッジ日時 2023-12-07 14:16:18
合計ジャッジ時間 20,927 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,460 KB
testcase_01 AC 36 ms
53,460 KB
testcase_02 AC 186 ms
77,580 KB
testcase_03 AC 134 ms
76,440 KB
testcase_04 AC 437 ms
76,716 KB
testcase_05 WA -
testcase_06 AC 190 ms
77,844 KB
testcase_07 AC 444 ms
77,512 KB
testcase_08 AC 135 ms
76,456 KB
testcase_09 AC 423 ms
76,588 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 133 ms
76,420 KB
testcase_13 AC 131 ms
77,188 KB
testcase_14 AC 132 ms
76,912 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 439 ms
76,588 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 425 ms
76,848 KB
testcase_21 AC 442 ms
76,716 KB
testcase_22 AC 168 ms
77,728 KB
testcase_23 WA -
testcase_24 AC 113 ms
76,084 KB
testcase_25 AC 155 ms
75,968 KB
testcase_26 AC 152 ms
77,732 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 1,791 ms
82,904 KB
testcase_31 WA -
testcase_32 AC 292 ms
101,928 KB
testcase_33 WA -
testcase_34 AC 408 ms
120,056 KB
testcase_35 AC 149 ms
91,896 KB
testcase_36 AC 318 ms
112,232 KB
testcase_37 TLE -
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 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

R=range
I=lambda:map(int,input().split())
T,m=I()
M=[m]
P=set()
def G(a,b):
	while a:a,b=b%a,a
	return b
while M:
	n=M.pop()
	if n in P:continue
	if n<99:
		for i in R(2,n+1):
			if n%i<1:
				P.add(i)
				while n%i<1:n//=i
	else:
		for t in R(99):
			x,d=t,1
			y=(x*x+1)%n
			while d<2:x,y,d=(x*x+1)%n,(y**4+2*y*y+2)%n,G(abs(x-y),n)
			if d<n:
				while n%d<1:n//=d
				M+=[d,n]
				break
		else:P.add(n)
P=list(P)
L=len(P)
Q=998244353
U=1<<L
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]*[1,-1][len([0for i in R(L)if d>>i&1<1])%2]
	print((v-(m<2))%Q)
0