結果
問題 | No.1330 Multiply or Divide |
ユーザー |
|
提出日時 | 2025-01-20 20:42:42 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 729 bytes |
コンパイル時間 | 624 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 119,552 KB |
最終ジャッジ日時 | 2025-01-20 20:42:50 |
合計ジャッジ時間 | 7,374 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 44 WA * 2 |
ソースコード
## https://yukicoder.me/problems/no/944import heapqdef main():N, M, P = map(int, input().split())A = list(map(int, input().split()))A.sort(reverse=True)p_array = []for i in range(N):a = A[i]p_cnt = 0while a % P == 0:a //= Pp_cnt += 1p_array.append((a, p_cnt))answer = float("inf")for a, p_cnt in p_array:if a > 1:ans = 0x = 1while x * A[0] <= M:x *= aans += p_cnt + 1answer = min(ans + 1, answer)if answer == float("inf"):print(-1)else:print(answer)if __name__ == "__main__":main()