結果
問題 | No.2578 Jewelry Store |
ユーザー | 👑 p-adic |
提出日時 | 2023-12-07 12:29:55 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 814 bytes |
コンパイル時間 | 211 ms |
コンパイル使用メモリ | 81,700 KB |
実行使用メモリ | 93,764 KB |
最終ジャッジ日時 | 2023-12-07 12:30:29 |
合計ジャッジ時間 | 32,309 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 37 ms
53,460 KB |
testcase_01 | AC | 37 ms
53,460 KB |
testcase_02 | AC | 511 ms
78,628 KB |
testcase_03 | AC | 312 ms
79,412 KB |
testcase_04 | AC | 1,338 ms
78,256 KB |
testcase_05 | AC | 178 ms
77,512 KB |
testcase_06 | AC | 532 ms
79,520 KB |
testcase_07 | AC | 1,351 ms
79,652 KB |
testcase_08 | AC | 276 ms
78,404 KB |
testcase_09 | AC | 1,278 ms
78,412 KB |
testcase_10 | AC | 2,318 ms
78,512 KB |
testcase_11 | AC | 173 ms
78,484 KB |
testcase_12 | AC | 310 ms
77,736 KB |
testcase_13 | AC | 192 ms
77,624 KB |
testcase_14 | AC | 201 ms
78,912 KB |
testcase_15 | AC | 231 ms
78,492 KB |
testcase_16 | AC | 2,393 ms
79,280 KB |
testcase_17 | AC | 1,419 ms
78,264 KB |
testcase_18 | AC | 221 ms
77,588 KB |
testcase_19 | AC | 829 ms
78,020 KB |
testcase_20 | AC | 1,395 ms
79,012 KB |
testcase_21 | AC | 1,399 ms
78,140 KB |
testcase_22 | AC | 625 ms
77,688 KB |
testcase_23 | AC | 3,335 ms
78,504 KB |
testcase_24 | AC | 1,688 ms
78,256 KB |
testcase_25 | AC | 1,718 ms
78,256 KB |
testcase_26 | AC | 697 ms
78,584 KB |
testcase_27 | TLE | - |
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 | -- | - |
ソースコード
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<999: 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(999): 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) E=[] for i in R(L): n=m while n%P[i]<1:n//=P[i] E+=[m//n] Q=998244353 for t in R(T): N,B,C,D=I() A=list(I()) b=[0]*N for i in R(L): for j in R(N):b[j]|=(A[j]%E[i]>0)*1<<i W=[] for a in A: W+=[1+B*(m%a<1)] B=(C*B+D)%Q v=0 for d in R(1<<L): w,S=1,[i for i in R(L)if d>>i&1] for j in R(N):w*=[1,W[j]][all(b[j]>>i&1for i in S)] v+=[w,-w][len(S)%2] print((v-(m<2))%Q)