結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
75,928 KB
testcase_01 AC 123 ms
107,860 KB
testcase_02 WA -
testcase_03 AC 75 ms
71,236 KB
testcase_04 AC 74 ms
70,964 KB
testcase_05 AC 75 ms
71,176 KB
testcase_06 AC 110 ms
104,212 KB
testcase_07 WA -
testcase_08 AC 142 ms
100,300 KB
testcase_09 AC 148 ms
100,540 KB
testcase_10 AC 145 ms
100,492 KB
testcase_11 AC 144 ms
100,524 KB
testcase_12 AC 142 ms
100,136 KB
testcase_13 AC 81 ms
76,216 KB
testcase_14 AC 78 ms
75,736 KB
testcase_15 AC 79 ms
75,808 KB
testcase_16 AC 78 ms
75,924 KB
testcase_17 AC 77 ms
75,596 KB
testcase_18 AC 123 ms
100,140 KB
testcase_19 AC 125 ms
100,200 KB
testcase_20 AC 123 ms
100,492 KB
testcase_21 AC 123 ms
100,400 KB
testcase_22 AC 123 ms
99,924 KB
testcase_23 AC 130 ms
101,864 KB
testcase_24 AC 74 ms
70,868 KB
testcase_25 AC 74 ms
71,368 KB
testcase_26 AC 79 ms
75,580 KB
testcase_27 AC 74 ms
71,216 KB
testcase_28 AC 74 ms
71,160 KB
testcase_29 AC 74 ms
71,324 KB
testcase_30 AC 74 ms
70,912 KB
testcase_31 AC 73 ms
71,424 KB
testcase_32 AC 75 ms
71,164 KB
testcase_33 AC 74 ms
71,172 KB
testcase_34 AC 108 ms
100,604 KB
testcase_35 AC 83 ms
80,600 KB
testcase_36 AC 103 ms
97,728 KB
testcase_37 AC 100 ms
94,948 KB
testcase_38 AC 92 ms
86,852 KB
testcase_39 AC 83 ms
81,768 KB
testcase_40 AC 87 ms
84,088 KB
testcase_41 AC 82 ms
78,360 KB
testcase_42 AC 100 ms
92,744 KB
testcase_43 AC 103 ms
95,088 KB
testcase_44 AC 114 ms
104,580 KB
testcase_45 AC 114 ms
104,768 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