結果

問題 No.1330 Multiply or Divide
ユーザー titiatitia
提出日時 2021-01-08 22:03:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 505 bytes
コンパイル時間 457 ms
コンパイル使用メモリ 87,164 KB
実行使用メモリ 109,932 KB
最終ジャッジ日時 2023-08-10 09:37:43
合計ジャッジ時間 9,124 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 156 ms
109,776 KB
testcase_02 WA -
testcase_03 AC 108 ms
77,268 KB
testcase_04 AC 107 ms
77,152 KB
testcase_05 AC 108 ms
77,220 KB
testcase_06 AC 148 ms
108,476 KB
testcase_07 WA -
testcase_08 AC 193 ms
104,416 KB
testcase_09 AC 194 ms
104,384 KB
testcase_10 AC 194 ms
104,396 KB
testcase_11 AC 174 ms
104,384 KB
testcase_12 AC 196 ms
104,224 KB
testcase_13 AC 121 ms
77,288 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 127 ms
77,112 KB
testcase_17 WA -
testcase_18 AC 162 ms
104,296 KB
testcase_19 AC 165 ms
104,164 KB
testcase_20 AC 163 ms
104,496 KB
testcase_21 AC 164 ms
104,396 KB
testcase_22 AC 163 ms
104,280 KB
testcase_23 AC 163 ms
106,484 KB
testcase_24 AC 106 ms
77,216 KB
testcase_25 AC 105 ms
77,360 KB
testcase_26 AC 108 ms
77,336 KB
testcase_27 AC 106 ms
77,032 KB
testcase_28 AC 105 ms
77,188 KB
testcase_29 AC 105 ms
77,352 KB
testcase_30 AC 104 ms
77,228 KB
testcase_31 AC 108 ms
77,236 KB
testcase_32 AC 112 ms
77,232 KB
testcase_33 AC 105 ms
77,432 KB
testcase_34 AC 147 ms
103,440 KB
testcase_35 AC 119 ms
83,080 KB
testcase_36 AC 143 ms
100,284 KB
testcase_37 AC 138 ms
97,640 KB
testcase_38 AC 129 ms
89,284 KB
testcase_39 AC 119 ms
83,896 KB
testcase_40 AC 124 ms
86,528 KB
testcase_41 AC 115 ms
80,652 KB
testcase_42 AC 136 ms
95,636 KB
testcase_43 AC 141 ms
97,936 KB
testcase_44 WA -
testcase_45 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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]=min(10**9+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)
0