結果

問題 No.1330 Multiply or Divide
ユーザー ayaoniayaoni
提出日時 2021-01-11 04:51:59
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 785 bytes
コンパイル時間 297 ms
コンパイル使用メモリ 87,040 KB
実行使用メモリ 107,724 KB
最終ジャッジ日時 2023-08-13 13:26:41
合計ジャッジ時間 6,881 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 121 ms
107,724 KB
testcase_02 AC 73 ms
71,004 KB
testcase_03 AC 73 ms
71,120 KB
testcase_04 AC 73 ms
71,124 KB
testcase_05 AC 72 ms
71,360 KB
testcase_06 AC 110 ms
104,540 KB
testcase_07 WA -
testcase_08 AC 128 ms
100,204 KB
testcase_09 AC 132 ms
100,416 KB
testcase_10 AC 130 ms
100,284 KB
testcase_11 AC 128 ms
100,444 KB
testcase_12 AC 128 ms
100,352 KB
testcase_13 AC 74 ms
71,064 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 73 ms
70,828 KB
testcase_17 WA -
testcase_18 AC 123 ms
99,880 KB
testcase_19 AC 120 ms
100,204 KB
testcase_20 AC 121 ms
100,128 KB
testcase_21 AC 120 ms
100,104 KB
testcase_22 AC 118 ms
100,020 KB
testcase_23 AC 122 ms
102,084 KB
testcase_24 AC 73 ms
71,164 KB
testcase_25 AC 72 ms
70,788 KB
testcase_26 AC 71 ms
71,096 KB
testcase_27 AC 72 ms
70,776 KB
testcase_28 AC 72 ms
70,980 KB
testcase_29 AC 72 ms
71,316 KB
testcase_30 AC 73 ms
71,284 KB
testcase_31 AC 71 ms
71,364 KB
testcase_32 AC 72 ms
70,916 KB
testcase_33 AC 73 ms
71,076 KB
testcase_34 AC 107 ms
100,656 KB
testcase_35 AC 85 ms
80,768 KB
testcase_36 AC 105 ms
97,556 KB
testcase_37 AC 100 ms
94,880 KB
testcase_38 AC 90 ms
86,540 KB
testcase_39 AC 87 ms
81,968 KB
testcase_40 AC 86 ms
84,084 KB
testcase_41 AC 82 ms
78,368 KB
testcase_42 AC 98 ms
92,612 KB
testcase_43 AC 103 ms
95,184 KB
testcase_44 WA -
testcase_45 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())


N,M,P = MI()
A = LI()

max_A = max(A)
ans = 1
X = (M+max_A)//max_A

if X == 1:
    print(ans)
    exit()

for i in range(N):
    a = A[i]
    if a % P == 0:
        while a % P == 0:
            a //= P
    A[i] = a

max_A = max(A)

if max_A == 1:
    print(-1)
    exit()

x = 1
while x < X:
    x *= max_A
    ans += 1

print(ans)
0