結果

問題 No.1330 Multiply or Divide
ユーザー maninimanini
提出日時 2021-01-26 11:01:50
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 902 bytes
コンパイル時間 914 ms
コンパイル使用メモリ 86,720 KB
実行使用メモリ 111,048 KB
最終ジャッジ日時 2023-09-05 14:46:53
合計ジャッジ時間 7,687 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 160 ms
111,048 KB
testcase_02 AC 74 ms
70,980 KB
testcase_03 AC 73 ms
71,284 KB
testcase_04 AC 74 ms
71,208 KB
testcase_05 AC 74 ms
71,228 KB
testcase_06 AC 114 ms
107,736 KB
testcase_07 WA -
testcase_08 AC 150 ms
103,540 KB
testcase_09 AC 154 ms
103,776 KB
testcase_10 AC 152 ms
103,360 KB
testcase_11 AC 150 ms
103,488 KB
testcase_12 AC 149 ms
103,492 KB
testcase_13 AC 75 ms
71,316 KB
testcase_14 AC 73 ms
71,252 KB
testcase_15 AC 72 ms
71,136 KB
testcase_16 AC 74 ms
71,220 KB
testcase_17 AC 75 ms
71,136 KB
testcase_18 AC 124 ms
100,512 KB
testcase_19 AC 124 ms
100,364 KB
testcase_20 AC 124 ms
100,388 KB
testcase_21 AC 125 ms
100,396 KB
testcase_22 AC 123 ms
99,940 KB
testcase_23 WA -
testcase_24 AC 76 ms
71,304 KB
testcase_25 AC 74 ms
71,388 KB
testcase_26 AC 74 ms
71,220 KB
testcase_27 AC 74 ms
71,436 KB
testcase_28 AC 74 ms
71,336 KB
testcase_29 AC 73 ms
71,476 KB
testcase_30 AC 75 ms
71,388 KB
testcase_31 AC 75 ms
71,384 KB
testcase_32 AC 74 ms
71,372 KB
testcase_33 AC 77 ms
71,004 KB
testcase_34 AC 110 ms
100,792 KB
testcase_35 AC 86 ms
80,856 KB
testcase_36 AC 103 ms
97,724 KB
testcase_37 AC 103 ms
94,948 KB
testcase_38 AC 92 ms
86,896 KB
testcase_39 AC 89 ms
81,868 KB
testcase_40 AC 88 ms
84,300 KB
testcase_41 AC 82 ms
78,752 KB
testcase_42 AC 100 ms
93,040 KB
testcase_43 AC 102 ms
95,216 KB
testcase_44 WA -
testcase_45 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding:UTF-8
import sys

MOD = 10 ** 9 + 7
INF = float('inf')

N, M, P = list(map(int, input().split()))     # スペース区切り連続数字
A = list(map(int, input().split()))     # スペース区切り連続数字

if max(A) > M:
    print("1")
    exit()

B = [0] * N
C = [0] * N

for i in range(N):
    c = 1
    b = A[i]
    while True:
        if b % 2 == 0:
            b //= 2
            c += 1
        else:
            B[i] = b
            C[i] = c
            break

res = INF
for i in range(N):
    if B[i] == 1:
        continue

    x = M // (A[i] * B[i])
    if (A[i] * B[i]) * (x - 1) > M:
        t = C[i] * (x - 1) + 1
        res = min(res, t)
    elif (A[i] * B[i]) * x > M:
        t = C[i] * x + 1
        res = min(res, t)
    elif (A[i] * B[i]) * (x + 1) > M:
        t = C[i] * (x + 1) + 1
        res = min(res, t)

if res == INF:
    print("-1")
else:
    print(res)
0