結果
問題 | No.2578 Jewelry Store |
ユーザー | 👑 p-adic |
提出日時 | 2023-12-07 15:22:16 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 818 bytes |
コンパイル時間 | 538 ms |
コンパイル使用メモリ | 81,700 KB |
実行使用メモリ | 120,272 KB |
最終ジャッジ日時 | 2023-12-07 15:22:38 |
合計ジャッジ時間 | 20,356 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 35 ms
53,460 KB |
testcase_01 | AC | 36 ms
53,460 KB |
testcase_02 | AC | 175 ms
76,804 KB |
testcase_03 | AC | 115 ms
76,320 KB |
testcase_04 | AC | 420 ms
76,720 KB |
testcase_05 | AC | 116 ms
76,260 KB |
testcase_06 | AC | 177 ms
76,812 KB |
testcase_07 | AC | 417 ms
76,868 KB |
testcase_08 | AC | 116 ms
76,332 KB |
testcase_09 | AC | 444 ms
76,592 KB |
testcase_10 | AC | 708 ms
77,748 KB |
testcase_11 | AC | 111 ms
76,140 KB |
testcase_12 | AC | 117 ms
76,296 KB |
testcase_13 | AC | 106 ms
76,552 KB |
testcase_14 | AC | 109 ms
76,276 KB |
testcase_15 | AC | 122 ms
76,924 KB |
testcase_16 | AC | 744 ms
77,620 KB |
testcase_17 | AC | 421 ms
76,720 KB |
testcase_18 | AC | 118 ms
76,420 KB |
testcase_19 | AC | 245 ms
76,448 KB |
testcase_20 | AC | 422 ms
76,848 KB |
testcase_21 | AC | 449 ms
76,720 KB |
testcase_22 | AC | 156 ms
76,692 KB |
testcase_23 | AC | 220 ms
76,084 KB |
testcase_24 | AC | 117 ms
75,840 KB |
testcase_25 | AC | 159 ms
75,972 KB |
testcase_26 | AC | 142 ms
76,320 KB |
testcase_27 | AC | 353 ms
76,328 KB |
testcase_28 | AC | 1,056 ms
78,280 KB |
testcase_29 | AC | 1,077 ms
78,276 KB |
testcase_30 | AC | 1,725 ms
82,744 KB |
testcase_31 | AC | 345 ms
76,456 KB |
testcase_32 | AC | 316 ms
101,900 KB |
testcase_33 | AC | 339 ms
96,840 KB |
testcase_34 | AC | 410 ms
120,272 KB |
testcase_35 | AC | 151 ms
91,892 KB |
testcase_36 | AC | 348 ms
113,284 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 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() if n<99: i=2 while i*i<=n: if n%i<1 and not i in P:r(i) while n%i<1:n//=i i+=1 if n>1:r(n) else: for t in R(99): x,d,c=t,1,0 y=(x*x+1)%n while d<2 and c*c<n:x,y,d,c=(x*x+1)%n,(y**4+2*y*y+2)%n,G(abs(x-y),n),c+1 if max(d,c*c)<n: M+=[n//d,d] break else:r(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)