結果

問題 No.210 探し物はどこですか?
ユーザー maspy
提出日時 2020-03-20 00:26:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 634 ms / 2,000 ms
コード長 511 bytes
コンパイル時間 417 ms
コンパイル使用メモリ 82,104 KB
実行使用メモリ 77,900 KB
最終ジャッジ日時 2024-12-14 03:40:58
合計ジャッジ時間 9,752 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/ python3.8
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from heapq import heapify, heappushpop

N = int(readline())
P = [int(x) / 1000 for x in readline().split()]
Q = [int(x) / 100 for x in readline().split()]

hq = [(-p * q, q) for p, q in zip(P, Q)]
heapify(hq)

S = 1.0
n = 0
answer = 0
while S > 1e-9:
    n += 1
    x, q = hq[0]
    answer += n * (-x)
    S += x
    x *= (1 - q)
    heappushpop(hq, (x, q))

print(answer)
0