結果
| 問題 |
No.210 探し物はどこですか?
|
| コンテスト | |
| ユーザー |
maspy
|
| 提出日時 | 2020-03-20 00:25:31 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 1,674 ms / 2,000 ms |
| コード長 | 526 bytes |
| コンパイル時間 | 303 ms |
| コンパイル使用メモリ | 81,900 KB |
| 実行使用メモリ | 83,780 KB |
| 最終ジャッジ日時 | 2024-12-14 03:40:48 |
| 合計ジャッジ時間 | 15,751 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 43 |
ソースコード
#!/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, p, q) for p, q in zip(P, Q)]
heapify(hq)
S = 1.0
n = 0
answer = 0
while S > 1e-9:
n += 1
x, p, q = hq[0]
answer += n * (-x)
S += x
p *= (1 - q)
heappushpop(hq, (-p * q, p, q))
print(answer)
maspy