結果

問題 No.1330 Multiply or Divide
ユーザー rlangevinrlangevin
提出日時 2024-04-17 12:05:49
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 510 bytes
コンパイル時間 456 ms
コンパイル使用メモリ 82,340 KB
実行使用メモリ 105,160 KB
最終ジャッジ日時 2024-04-17 12:06:01
合計ジャッジ時間 6,016 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
52,096 KB
testcase_01 AC 139 ms
103,808 KB
testcase_02 AC 40 ms
52,096 KB
testcase_03 AC 40 ms
51,968 KB
testcase_04 AC 45 ms
58,496 KB
testcase_05 AC 40 ms
51,712 KB
testcase_06 AC 93 ms
98,304 KB
testcase_07 WA -
testcase_08 AC 121 ms
101,760 KB
testcase_09 AC 126 ms
101,504 KB
testcase_10 AC 121 ms
101,760 KB
testcase_11 AC 116 ms
101,760 KB
testcase_12 AC 145 ms
101,632 KB
testcase_13 AC 43 ms
52,352 KB
testcase_14 AC 42 ms
52,096 KB
testcase_15 AC 42 ms
51,840 KB
testcase_16 AC 43 ms
52,096 KB
testcase_17 AC 43 ms
52,248 KB
testcase_18 AC 115 ms
101,888 KB
testcase_19 AC 117 ms
101,760 KB
testcase_20 AC 115 ms
101,888 KB
testcase_21 AC 110 ms
101,888 KB
testcase_22 AC 112 ms
101,760 KB
testcase_23 AC 115 ms
102,144 KB
testcase_24 AC 43 ms
51,968 KB
testcase_25 AC 43 ms
51,840 KB
testcase_26 AC 43 ms
52,096 KB
testcase_27 AC 65 ms
51,968 KB
testcase_28 AC 42 ms
51,584 KB
testcase_29 AC 40 ms
51,968 KB
testcase_30 AC 42 ms
51,840 KB
testcase_31 AC 43 ms
51,968 KB
testcase_32 AC 40 ms
51,968 KB
testcase_33 AC 42 ms
51,968 KB
testcase_34 AC 91 ms
96,768 KB
testcase_35 AC 60 ms
69,376 KB
testcase_36 AC 84 ms
92,928 KB
testcase_37 AC 81 ms
88,960 KB
testcase_38 AC 70 ms
77,440 KB
testcase_39 AC 61 ms
71,168 KB
testcase_40 AC 66 ms
74,112 KB
testcase_41 AC 58 ms
66,560 KB
testcase_42 AC 80 ms
86,144 KB
testcase_43 AC 103 ms
89,600 KB
testcase_44 AC 119 ms
98,944 KB
testcase_45 AC 94 ms
99,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M, P = map(int, input().split())
A = list(map(int, input().split()))
ma = max(A)

K, K2 = 35, 70
D = [1] * K
for i in range(N):
    cnt = 0
    while A[i] % P == 0:
        cnt += 1
        A[i] //= P
    D[cnt] = max(D[cnt], A[i])

inf = 10 ** 18
dp = [-inf] * K2
dp[0] = 1
for i in range(K2):
    if dp[i] * ma > M:
        print(i + 1)
        exit()
        
    for j in range(K):
        if i + j + 1 >= K2:
            break
        dp[i + j + 1] = max(dp[i + j + 1], dp[i] * D[j])
        
print(-1)
0