結果

問題 No.1173 Endangered Species
コンテスト
ユーザー anagohirame
提出日時 2020-08-14 23:39:14
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 135 ms / 2,000 ms
コード長 388 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 296 ms
コンパイル使用メモリ 84,864 KB
実行使用メモリ 107,392 KB
最終ジャッジ日時 2026-04-26 19:31:37
合計ジャッジ時間 2,678 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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