結果

問題 No.1330 Multiply or Divide
ユーザー c-yanc-yan
提出日時 2021-01-08 22:43:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 467 bytes
コンパイル時間 146 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 32,784 KB
最終ジャッジ日時 2024-04-28 04:12:14
合計ジャッジ時間 9,828 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 332 ms
29,304 KB
testcase_02 AC 29 ms
10,624 KB
testcase_03 AC 29 ms
10,752 KB
testcase_04 AC 28 ms
10,752 KB
testcase_05 AC 29 ms
10,624 KB
testcase_06 AC 135 ms
14,428 KB
testcase_07 WA -
testcase_08 AC 341 ms
32,404 KB
testcase_09 AC 349 ms
32,784 KB
testcase_10 AC 343 ms
32,656 KB
testcase_11 AC 346 ms
32,408 KB
testcase_12 AC 346 ms
32,660 KB
testcase_13 AC 29 ms
10,752 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 28 ms
10,624 KB
testcase_17 WA -
testcase_18 AC 102 ms
32,784 KB
testcase_19 AC 102 ms
32,400 KB
testcase_20 AC 102 ms
32,524 KB
testcase_21 AC 104 ms
32,656 KB
testcase_22 AC 101 ms
32,404 KB
testcase_23 AC 336 ms
32,560 KB
testcase_24 AC 29 ms
10,624 KB
testcase_25 AC 29 ms
10,752 KB
testcase_26 AC 29 ms
10,752 KB
testcase_27 AC 28 ms
10,752 KB
testcase_28 AC 30 ms
10,752 KB
testcase_29 AC 30 ms
10,752 KB
testcase_30 AC 30 ms
10,752 KB
testcase_31 AC 30 ms
10,752 KB
testcase_32 AC 30 ms
10,624 KB
testcase_33 AC 31 ms
10,624 KB
testcase_34 AC 85 ms
26,880 KB
testcase_35 AC 44 ms
15,044 KB
testcase_36 AC 78 ms
25,040 KB
testcase_37 AC 72 ms
23,436 KB
testcase_38 AC 57 ms
18,760 KB
testcase_39 AC 48 ms
16,256 KB
testcase_40 AC 51 ms
17,236 KB
testcase_41 AC 40 ms
14,104 KB
testcase_42 AC 70 ms
22,524 KB
testcase_43 AC 74 ms
24,508 KB
testcase_44 WA -
testcase_45 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(x):
    c = 0
    while x % P == 0:
        c += 1
        x //= P
    return (x, c)

N, M, P, *A = map(int, open(0).read().split())

max_A = max(A)

if max_A > M:
    print(1)
    exit()

result = 10 ** 20
for m, c in map(f, A):
    if m == 1:
        continue
    t = 0
    x = 1
    while True:
        t += 1
        if x * max_A > M:
            break
        x *= m
    result = min(result, t)
if result == 10 ** 20:
    print(-1)
else:
    print(result)
0