結果

問題 No.1173 Endangered Species
ユーザー anagohirameanagohirame
提出日時 2020-08-14 23:39:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 213 ms / 2,000 ms
コード長 388 bytes
コンパイル時間 1,255 ms
コンパイル使用メモリ 86,864 KB
実行使用メモリ 107,592 KB
最終ジャッジ日時 2023-08-01 00:14:24
合計ジャッジ時間 5,024 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,552 KB
testcase_01 AC 73 ms
71,404 KB
testcase_02 AC 72 ms
71,608 KB
testcase_03 AC 74 ms
71,460 KB
testcase_04 AC 72 ms
71,772 KB
testcase_05 AC 72 ms
71,280 KB
testcase_06 AC 70 ms
71,748 KB
testcase_07 AC 71 ms
71,632 KB
testcase_08 AC 71 ms
71,160 KB
testcase_09 AC 72 ms
71,564 KB
testcase_10 AC 78 ms
76,228 KB
testcase_11 AC 79 ms
76,292 KB
testcase_12 AC 86 ms
76,648 KB
testcase_13 AC 85 ms
76,904 KB
testcase_14 AC 100 ms
77,868 KB
testcase_15 AC 96 ms
77,832 KB
testcase_16 AC 154 ms
90,108 KB
testcase_17 AC 195 ms
104,884 KB
testcase_18 AC 212 ms
107,432 KB
testcase_19 AC 213 ms
107,320 KB
testcase_20 AC 211 ms
107,584 KB
testcase_21 AC 211 ms
107,592 KB
権限があれば一括ダウンロードができます

ソースコード

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