結果

問題 No.1330 Multiply or Divide
ユーザー googol_S0
提出日時 2021-01-08 21:29:22
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 370 bytes
コンパイル時間 235 ms
コンパイル使用メモリ 82,292 KB
実行使用メモリ 145,568 KB
最終ジャッジ日時 2024-11-16 10:14:52
合計ジャッジ時間 13,206 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 43 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M,P=map(int,input().split())
A=list(map(int,input().split()))
B=[]
C=[]
for i in range(N):
  B.append(A[i])
  C.append(1)
  while B[i]%P==0:
    B[i]//=P
    C[i]+=1
Z=max(A)
X=(M+Z-1)//Z
if max(B)==1 and X>1:
  print(-1)
  exit()
D=[[B[i],C[i]] for i in range(N)]
D.sort(key=lambda x:((x[0]**10)**(1/x[1])))
P=0
Y=1
while Y*Z<M:
  Y*=D[-1][0]
  P+=D[-1][1]
print(P+1)
0