結果

問題 No.1330 Multiply or Divide
ユーザー chineristACchineristAC
提出日時 2021-01-08 22:57:27
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 528 bytes
コンパイル時間 245 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 120,264 KB
最終ジャッジ日時 2024-04-28 04:39:05
合計ジャッジ時間 33,817 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1,566 ms
109,696 KB
testcase_02 WA -
testcase_03 AC 35 ms
54,128 KB
testcase_04 AC 35 ms
52,336 KB
testcase_05 AC 41 ms
59,660 KB
testcase_06 AC 77 ms
97,152 KB
testcase_07 TLE -
testcase_08 AC 1,548 ms
117,540 KB
testcase_09 AC 1,651 ms
117,648 KB
testcase_10 AC 1,387 ms
117,904 KB
testcase_11 AC 1,658 ms
118,048 KB
testcase_12 AC 1,514 ms
118,320 KB
testcase_13 AC 44 ms
60,160 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 43 ms
59,776 KB
testcase_17 WA -
testcase_18 AC 1,567 ms
117,848 KB
testcase_19 AC 1,569 ms
117,416 KB
testcase_20 AC 1,599 ms
117,552 KB
testcase_21 AC 1,578 ms
117,904 KB
testcase_22 AC 1,570 ms
117,520 KB
testcase_23 WA -
testcase_24 AC 40 ms
60,092 KB
testcase_25 AC 40 ms
59,916 KB
testcase_26 WA -
testcase_27 AC 44 ms
53,780 KB
testcase_28 AC 41 ms
60,036 KB
testcase_29 AC 40 ms
59,728 KB
testcase_30 AC 38 ms
59,988 KB
testcase_31 AC 40 ms
60,700 KB
testcase_32 AC 38 ms
60,608 KB
testcase_33 AC 40 ms
61,024 KB
testcase_34 AC 1,192 ms
105,688 KB
testcase_35 AC 364 ms
84,668 KB
testcase_36 AC 1,080 ms
107,136 KB
testcase_37 AC 959 ms
105,808 KB
testcase_38 AC 621 ms
93,400 KB
testcase_39 AC 475 ms
85,760 KB
testcase_40 AC 520 ms
88,932 KB
testcase_41 AC 287 ms
80,768 KB
testcase_42 AC 887 ms
102,656 KB
testcase_43 AC 1,019 ms
106,000 KB
testcase_44 WA -
testcase_45 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

B = []
for a in A:
    cost = 1
    while a%P==0:
        a //= P
        cost += 1
    if a!=1:
        B.append((cost,a))

if not B:
    exit(print(-1))

n = len(B)
dp = [1 for i in range(901)]
for i in range(n):
    cost,a = B[i]
    next = [dp[j] for j in range(901)]
    for j in range(901-cost):
        next[j+cost] = max(next[j+cost],min(M,dp[j]*a),min(M,next[j]*a))
    dp = next

for i in range(901):
    if dp[i]==M:
        print(i)
        break
0