結果

問題 No.1330 Multiply or Divide
ユーザー Kite_kumaKite_kuma
提出日時 2021-01-08 21:42:59
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 576 bytes
コンパイル時間 1,024 ms
コンパイル使用メモリ 87,156 KB
実行使用メモリ 132,776 KB
最終ジャッジ日時 2023-08-10 13:04:50
合計ジャッジ時間 8,308 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
72,140 KB
testcase_01 AC 139 ms
108,092 KB
testcase_02 WA -
testcase_03 AC 68 ms
72,060 KB
testcase_04 AC 69 ms
71,444 KB
testcase_05 AC 69 ms
72,256 KB
testcase_06 AC 127 ms
131,856 KB
testcase_07 AC 352 ms
107,628 KB
testcase_08 AC 157 ms
127,992 KB
testcase_09 AC 159 ms
128,356 KB
testcase_10 AC 157 ms
127,956 KB
testcase_11 AC 157 ms
128,036 KB
testcase_12 AC 159 ms
128,252 KB
testcase_13 AC 72 ms
72,012 KB
testcase_14 AC 69 ms
72,364 KB
testcase_15 AC 71 ms
72,176 KB
testcase_16 AC 70 ms
72,012 KB
testcase_17 AC 70 ms
72,340 KB
testcase_18 AC 146 ms
127,892 KB
testcase_19 AC 147 ms
128,012 KB
testcase_20 AC 146 ms
127,976 KB
testcase_21 AC 146 ms
128,048 KB
testcase_22 AC 147 ms
128,052 KB
testcase_23 AC 152 ms
128,160 KB
testcase_24 AC 68 ms
72,300 KB
testcase_25 AC 70 ms
72,224 KB
testcase_26 AC 71 ms
72,172 KB
testcase_27 AC 69 ms
71,936 KB
testcase_28 AC 69 ms
72,096 KB
testcase_29 AC 72 ms
71,952 KB
testcase_30 AC 70 ms
72,040 KB
testcase_31 AC 71 ms
72,036 KB
testcase_32 AC 69 ms
71,832 KB
testcase_33 AC 71 ms
71,952 KB
testcase_34 AC 122 ms
101,664 KB
testcase_35 AC 86 ms
86,284 KB
testcase_36 AC 115 ms
98,992 KB
testcase_37 AC 111 ms
112,528 KB
testcase_38 AC 97 ms
97,496 KB
testcase_39 AC 89 ms
88,512 KB
testcase_40 AC 92 ms
92,312 KB
testcase_41 AC 83 ms
82,348 KB
testcase_42 AC 108 ms
108,200 KB
testcase_43 AC 115 ms
113,024 KB
testcase_44 AC 195 ms
132,776 KB
testcase_45 AC 221 ms
132,744 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m, p = map(int, input().split())
a = list(map(int, input().split()))
d = list()
cnt = list()
flag = True
for c in a:
    tmp = 0
    while c % p == 0:
        c //= p
        tmp += 1
    if c > 1:
        flag = False
    d.append(c)
    cnt.append(tmp)
if flag:
    print(-1)
    exit()

dp = [1] * (100000)


for i in range(100000):
    now = dp[i]
    if now > m:
        print(i)
        exit()
    for j in range(n):
        c = a[j]
        if now * c > m:
            print(i + 1)
            exit()
        dp[i + cnt[j] + 1] = max(dp[i + cnt[j] + 1], now * d[j])
0