結果

問題 No.1330 Multiply or Divide
ユーザー titiatitia
提出日時 2021-01-08 21:39:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 486 bytes
コンパイル時間 104 ms
コンパイル使用メモリ 10,776 KB
実行使用メモリ 31,376 KB
最終ジャッジ日時 2023-08-10 09:01:26
合計ジャッジ時間 9,724 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 258 ms
30,028 KB
testcase_02 WA -
testcase_03 AC 45 ms
8,328 KB
testcase_04 AC 46 ms
7,964 KB
testcase_05 AC 51 ms
9,140 KB
testcase_06 AC 277 ms
13,020 KB
testcase_07 WA -
testcase_08 AC 296 ms
30,444 KB
testcase_09 AC 325 ms
30,308 KB
testcase_10 AC 295 ms
30,436 KB
testcase_11 AC 275 ms
30,152 KB
testcase_12 AC 293 ms
30,396 KB
testcase_13 AC 64 ms
10,640 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 55 ms
10,820 KB
testcase_17 WA -
testcase_18 AC 259 ms
30,200 KB
testcase_19 AC 256 ms
30,400 KB
testcase_20 AC 253 ms
30,260 KB
testcase_21 AC 265 ms
30,060 KB
testcase_22 AC 263 ms
30,200 KB
testcase_23 AC 267 ms
30,040 KB
testcase_24 AC 46 ms
8,632 KB
testcase_25 AC 44 ms
8,500 KB
testcase_26 AC 45 ms
8,500 KB
testcase_27 AC 46 ms
8,616 KB
testcase_28 AC 45 ms
8,456 KB
testcase_29 AC 45 ms
8,544 KB
testcase_30 AC 44 ms
8,580 KB
testcase_31 AC 45 ms
8,652 KB
testcase_32 AC 47 ms
8,352 KB
testcase_33 AC 44 ms
8,476 KB
testcase_34 AC 210 ms
24,324 KB
testcase_35 AC 91 ms
14,816 KB
testcase_36 AC 183 ms
22,800 KB
testcase_37 AC 172 ms
21,308 KB
testcase_38 AC 127 ms
16,172 KB
testcase_39 AC 100 ms
14,636 KB
testcase_40 AC 111 ms
16,136 KB
testcase_41 AC 81 ms
13,600 KB
testcase_42 AC 164 ms
19,868 KB
testcase_43 AC 176 ms
22,204 KB
testcase_44 WA -
testcase_45 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

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

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

for i in range(N):
    a=A[i]
    while a%P==0:
        B[i]+=1
        a//=P
    C[i]=a

K=[0]*50

for i in range(N):
    K[B[i]]=max(K[B[i]],C[i])


DP=[0]*1000
DP[0]=1

for i in range(950):
    for j in range(49,-1,-1):
        DP[i+j+1]=max(DP[i+j+1],DP[i]*K[j])
        
for i in range(1000):
    if DP[i]>M:
        print(i)
        break
else:
    print(-1)
0