結果

問題 No.1330 Multiply or Divide
ユーザー AEnAEn
提出日時 2023-01-11 23:12:31
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 625 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 87,032 KB
実行使用メモリ 107,976 KB
最終ジャッジ日時 2023-08-24 03:48:52
合計ジャッジ時間 6,878 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
75,952 KB
testcase_01 AC 122 ms
107,972 KB
testcase_02 AC 72 ms
71,576 KB
testcase_03 AC 72 ms
71,636 KB
testcase_04 AC 71 ms
71,676 KB
testcase_05 AC 72 ms
71,536 KB
testcase_06 AC 107 ms
104,644 KB
testcase_07 WA -
testcase_08 AC 142 ms
100,724 KB
testcase_09 AC 146 ms
100,528 KB
testcase_10 AC 142 ms
100,776 KB
testcase_11 AC 141 ms
100,588 KB
testcase_12 AC 141 ms
100,524 KB
testcase_13 AC 81 ms
76,508 KB
testcase_14 AC 78 ms
76,144 KB
testcase_15 AC 78 ms
76,200 KB
testcase_16 AC 76 ms
76,180 KB
testcase_17 AC 78 ms
75,748 KB
testcase_18 AC 123 ms
100,512 KB
testcase_19 AC 122 ms
100,556 KB
testcase_20 AC 123 ms
100,200 KB
testcase_21 AC 123 ms
100,104 KB
testcase_22 AC 124 ms
100,312 KB
testcase_23 AC 131 ms
102,280 KB
testcase_24 AC 72 ms
71,288 KB
testcase_25 AC 71 ms
71,520 KB
testcase_26 AC 74 ms
75,976 KB
testcase_27 AC 71 ms
71,220 KB
testcase_28 AC 71 ms
71,324 KB
testcase_29 AC 71 ms
71,220 KB
testcase_30 AC 70 ms
71,588 KB
testcase_31 AC 71 ms
71,336 KB
testcase_32 AC 72 ms
71,032 KB
testcase_33 AC 72 ms
71,092 KB
testcase_34 AC 106 ms
100,740 KB
testcase_35 AC 83 ms
80,972 KB
testcase_36 AC 102 ms
97,820 KB
testcase_37 AC 99 ms
95,172 KB
testcase_38 AC 90 ms
87,024 KB
testcase_39 AC 84 ms
81,840 KB
testcase_40 AC 85 ms
84,212 KB
testcase_41 AC 78 ms
79,124 KB
testcase_42 AC 99 ms
92,928 KB
testcase_43 AC 99 ms
95,440 KB
testcase_44 AC 112 ms
105,032 KB
testcase_45 AC 114 ms
104,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import ceil

N, M, P = map(int,input().split())
A = list(map(int, input().split()))
M += 1
m = max(A)
if m>=M:
    print(1)
    exit()
d = {}
for i in range(N):
    cnt = 1
    while A[i]%P==0:
        cnt += 1
        A[i] //= P
    if A[i]==1:
        continue
    if cnt in d:
        d[cnt] = max(d[cnt],A[i])
    else:
        d[cnt] = A[i]

if len(d)==0:
    print(-1)
    exit()
n = ceil(M/m)

dp = [0]*901
dp[0] = 1
for i in range(901):
    for key in d.keys():
        if i+key<=60:
            dp[i+key] = max(dp[i+key],dp[i]*d[key])
for i in range(901):
    if dp[i]>=n:
        print(i+1)
        exit()
0