結果

問題 No.1330 Multiply or Divide
ユーザー brthyyjpbrthyyjp
提出日時 2022-02-03 15:26:47
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 549 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 87,072 KB
実行使用メモリ 107,968 KB
最終ジャッジ日時 2023-09-02 03:18:29
合計ジャッジ時間 7,734 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
71,560 KB
testcase_01 AC 136 ms
107,968 KB
testcase_02 AC 87 ms
71,720 KB
testcase_03 AC 86 ms
71,652 KB
testcase_04 AC 87 ms
71,812 KB
testcase_05 AC 88 ms
71,816 KB
testcase_06 AC 130 ms
105,888 KB
testcase_07 WA -
testcase_08 AC 154 ms
100,584 KB
testcase_09 AC 159 ms
101,372 KB
testcase_10 AC 157 ms
101,208 KB
testcase_11 AC 148 ms
100,736 KB
testcase_12 AC 156 ms
100,760 KB
testcase_13 AC 99 ms
77,200 KB
testcase_14 AC 99 ms
77,204 KB
testcase_15 AC 94 ms
77,164 KB
testcase_16 AC 94 ms
77,292 KB
testcase_17 AC 96 ms
77,136 KB
testcase_18 AC 143 ms
100,420 KB
testcase_19 AC 146 ms
100,660 KB
testcase_20 AC 147 ms
100,692 KB
testcase_21 AC 145 ms
100,768 KB
testcase_22 AC 144 ms
100,780 KB
testcase_23 AC 145 ms
102,648 KB
testcase_24 AC 87 ms
71,564 KB
testcase_25 AC 87 ms
71,388 KB
testcase_26 AC 86 ms
71,648 KB
testcase_27 AC 87 ms
71,760 KB
testcase_28 AC 86 ms
71,396 KB
testcase_29 AC 85 ms
71,796 KB
testcase_30 AC 87 ms
71,904 KB
testcase_31 AC 87 ms
71,816 KB
testcase_32 AC 87 ms
71,536 KB
testcase_33 AC 86 ms
71,708 KB
testcase_34 AC 128 ms
101,744 KB
testcase_35 AC 100 ms
82,876 KB
testcase_36 AC 127 ms
98,964 KB
testcase_37 AC 121 ms
96,864 KB
testcase_38 AC 110 ms
87,940 KB
testcase_39 AC 103 ms
82,564 KB
testcase_40 AC 107 ms
84,760 KB
testcase_41 AC 101 ms
81,076 KB
testcase_42 AC 119 ms
94,688 KB
testcase_43 AC 123 ms
96,908 KB
testcase_44 AC 130 ms
105,940 KB
testcase_45 AC 132 ms
105,820 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m, p = map(int, input().split())
A = list(map(int, input().split()))

from collections import defaultdict
C = defaultdict(lambda: 0)
D = []
for a in A:
    b = a
    cost = 1
    while a%p == 0:
        cost += 1
        a //= p
    C[cost] = max(C[cost], a)

M = max(A)

dp = [0]*101
dp[0] = 1
for c, a in C.items():
    for i in range(101):
        if i+c <= 100:
            dp[i+c] = max(dp[i+c], dp[i]*a)
ans = 10**18
for i, x in enumerate(dp):
    if x*M> m:
        ans = min(ans, i+1)
if ans != 10**18:
    print(ans)
else:
    print(-1)
0