結果
| 問題 |
No.1330 Multiply or Divide
|
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2021-01-08 21:47:05 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 492 bytes |
| コンパイル時間 | 219 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 1,498,540 KB |
| 最終ジャッジ日時 | 2024-11-16 11:05:06 |
| 合計ジャッジ時間 | 88,324 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 WA * 3 TLE * 11 MLE * 30 |
ソースコード
import sys
input = sys.stdin.readline
N,M,P=map(int,input().split())
A=list(map(int,input().split()))
B=[0]*N
C=[0]*N
for i in range(N):
a=A[i]
while a%P==0:
B[i]+=1
a//=P
C[i]=a
K=[0]*50
for i in range(N):
K[B[i]]=max(K[B[i]],C[i])
DP=[0]*100000
DP[0]=1
for i in range(95000):
for j in range(49,-1,-1):
DP[i+j+1]=max(DP[i+j+1],DP[i]*K[j])
for i in range(100000):
if DP[i]>M:
print(i)
break
else:
print(-1)
titia