結果

問題 No.1173 Endangered Species
ユーザー anagohirame
提出日時 2020-08-14 23:39:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 183 ms / 2,000 ms
コード長 388 bytes
コンパイル時間 375 ms
コンパイル使用メモリ 81,952 KB
実行使用メモリ 108,688 KB
最終ジャッジ日時 2024-10-10 16:53:26
合計ジャッジ時間 3,027 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import log
n = int(input())
p = list(map(float, input().split()))
q = list(map(float, input().split()))
a = list(map(int, input().split()))

def f(x):
	return sum(p[i] * (1-q[i]) / (1-q[i]*x) for i in range(n)) - x

l, r = 0, 1
for _ in range(50):
	x = (l+r)/2
	if f(x) < 0:
		r = x
	else:
		l = x

ans = 0
for i in range(n):
	ans += a[i] * log((1-q[i]) / (1-q[i]*r))
print(ans)
0