結果
問題 | No.2578 Jewelry Store |
ユーザー | 👑 p-adic |
提出日時 | 2023-12-07 14:28:21 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 737 bytes |
コンパイル時間 | 229 ms |
コンパイル使用メモリ | 81,700 KB |
実行使用メモリ | 120,332 KB |
最終ジャッジ日時 | 2023-12-07 14:28:42 |
合計ジャッジ時間 | 19,966 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 40 ms
53,460 KB |
testcase_01 | AC | 39 ms
53,460 KB |
testcase_02 | AC | 177 ms
76,800 KB |
testcase_03 | AC | 117 ms
76,312 KB |
testcase_04 | AC | 417 ms
76,716 KB |
testcase_05 | AC | 117 ms
76,260 KB |
testcase_06 | AC | 176 ms
76,808 KB |
testcase_07 | AC | 410 ms
76,828 KB |
testcase_08 | AC | 117 ms
76,328 KB |
testcase_09 | AC | 413 ms
76,588 KB |
testcase_10 | AC | 713 ms
77,628 KB |
testcase_11 | AC | 109 ms
76,268 KB |
testcase_12 | AC | 116 ms
76,292 KB |
testcase_13 | AC | 106 ms
76,552 KB |
testcase_14 | AC | 110 ms
76,276 KB |
testcase_15 | AC | 121 ms
76,920 KB |
testcase_16 | AC | 714 ms
77,628 KB |
testcase_17 | AC | 407 ms
76,716 KB |
testcase_18 | AC | 118 ms
76,332 KB |
testcase_19 | AC | 244 ms
76,572 KB |
testcase_20 | AC | 410 ms
76,720 KB |
testcase_21 | AC | 406 ms
76,716 KB |
testcase_22 | AC | 154 ms
76,688 KB |
testcase_23 | AC | 217 ms
76,092 KB |
testcase_24 | AC | 116 ms
75,828 KB |
testcase_25 | AC | 156 ms
75,840 KB |
testcase_26 | AC | 142 ms
76,440 KB |
testcase_27 | AC | 350 ms
76,324 KB |
testcase_28 | AC | 1,048 ms
78,160 KB |
testcase_29 | AC | 1,051 ms
78,412 KB |
testcase_30 | AC | 1,718 ms
82,772 KB |
testcase_31 | AC | 347 ms
76,452 KB |
testcase_32 | AC | 293 ms
101,936 KB |
testcase_33 | AC | 334 ms
96,844 KB |
testcase_34 | AC | 409 ms
120,332 KB |
testcase_35 | AC | 149 ms
91,896 KB |
testcase_36 | AC | 317 ms
112,788 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 | -- | - |
ソースコード
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([1for i in R(L)if d>>i&1])%2] print((v-(m<2))%Q)