結果

問題 No.1330 Multiply or Divide
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-01-09 15:08:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,009 ms / 2,000 ms
コード長 495 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 33,040 KB
最終ジャッジ日時 2024-04-28 22:21:04
合計ジャッジ時間 7,000 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
10,624 KB
testcase_01 AC 236 ms
29,452 KB
testcase_02 AC 31 ms
10,752 KB
testcase_03 AC 31 ms
10,624 KB
testcase_04 AC 71 ms
10,624 KB
testcase_05 AC 31 ms
10,752 KB
testcase_06 AC 200 ms
13,916 KB
testcase_07 AC 1,009 ms
30,812 KB
testcase_08 AC 260 ms
33,036 KB
testcase_09 AC 282 ms
32,908 KB
testcase_10 AC 255 ms
33,040 KB
testcase_11 AC 242 ms
32,676 KB
testcase_12 AC 256 ms
32,908 KB
testcase_13 AC 30 ms
10,752 KB
testcase_14 AC 30 ms
10,752 KB
testcase_15 AC 30 ms
10,624 KB
testcase_16 AC 31 ms
10,752 KB
testcase_17 AC 31 ms
10,880 KB
testcase_18 AC 108 ms
32,676 KB
testcase_19 AC 105 ms
32,912 KB
testcase_20 AC 105 ms
32,916 KB
testcase_21 AC 107 ms
32,548 KB
testcase_22 AC 105 ms
32,548 KB
testcase_23 AC 232 ms
32,712 KB
testcase_24 AC 31 ms
10,752 KB
testcase_25 AC 32 ms
10,752 KB
testcase_26 AC 31 ms
10,752 KB
testcase_27 AC 30 ms
10,624 KB
testcase_28 AC 31 ms
10,752 KB
testcase_29 AC 31 ms
10,752 KB
testcase_30 AC 31 ms
10,752 KB
testcase_31 AC 30 ms
10,752 KB
testcase_32 AC 30 ms
10,752 KB
testcase_33 AC 30 ms
10,624 KB
testcase_34 AC 88 ms
27,036 KB
testcase_35 AC 47 ms
15,184 KB
testcase_36 AC 82 ms
25,060 KB
testcase_37 AC 76 ms
23,548 KB
testcase_38 AC 59 ms
18,652 KB
testcase_39 AC 51 ms
16,352 KB
testcase_40 AC 54 ms
17,388 KB
testcase_41 AC 43 ms
13,992 KB
testcase_42 AC 71 ms
22,540 KB
testcase_43 AC 78 ms
24,760 KB
testcase_44 AC 233 ms
14,048 KB
testcase_45 AC 236 ms
13,916 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m,p = map(int,input().split())
a = list(map(int,input().split()))
ans = float("INF")
ma = max(a)
if ma > m:
    print(1)
    exit()
MAX = [0]*40
for i in a:
    now = i
    count = 1
    while now%p == 0:
        now //= p
        count += 1
    if now == 1:
        continue
    MAX[count] = max(MAX[count],now)
dp = [0]*2000
dp[0] = 1
for i in range(1600):
    if ma * dp[i] > m:
        print(i+1)
        exit()
    for j in range(40):
        dp[i+j] = max(dp[i+j],dp[i]*MAX[j])
print(-1)
0