結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1,258 ms
109,184 KB
testcase_02 WA -
testcase_03 AC 43 ms
52,224 KB
testcase_04 AC 42 ms
51,712 KB
testcase_05 AC 50 ms
59,008 KB
testcase_06 AC 86 ms
96,896 KB
testcase_07 WA -
testcase_08 AC 1,239 ms
117,976 KB
testcase_09 AC 1,327 ms
117,848 KB
testcase_10 AC 1,106 ms
117,752 KB
testcase_11 AC 1,333 ms
117,848 KB
testcase_12 AC 1,242 ms
117,852 KB
testcase_13 AC 53 ms
60,032 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 50 ms
59,136 KB
testcase_17 WA -
testcase_18 AC 1,272 ms
117,720 KB
testcase_19 AC 1,276 ms
117,848 KB
testcase_20 AC 1,260 ms
117,344 KB
testcase_21 AC 1,261 ms
117,464 KB
testcase_22 AC 1,260 ms
117,712 KB
testcase_23 WA -
testcase_24 AC 49 ms
59,520 KB
testcase_25 AC 49 ms
59,136 KB
testcase_26 WA -
testcase_27 AC 43 ms
52,224 KB
testcase_28 AC 50 ms
59,264 KB
testcase_29 AC 50 ms
59,136 KB
testcase_30 AC 48 ms
58,752 KB
testcase_31 AC 50 ms
59,392 KB
testcase_32 AC 50 ms
59,264 KB
testcase_33 AC 49 ms
59,264 KB
testcase_34 AC 959 ms
105,088 KB
testcase_35 AC 310 ms
84,096 KB
testcase_36 AC 858 ms
107,136 KB
testcase_37 AC 769 ms
105,600 KB
testcase_38 AC 506 ms
93,184 KB
testcase_39 AC 367 ms
85,504 KB
testcase_40 AC 429 ms
88,960 KB
testcase_41 AC 253 ms
80,896 KB
testcase_42 AC 713 ms
102,016 KB
testcase_43 AC 817 ms
105,856 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(601)]
for i in range(n):
    cost,a = B[i]
    next = [dp[j] for j in range(601)]
    for j in range(601-cost):
        next[j+cost] = max(next[j+cost],min(M,dp[j]*a),min(M,next[j]*a))
    dp = next

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