結果

問題 No.1173 Endangered Species
ユーザー anagohirameanagohirame
提出日時 2020-08-14 23:39:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 181 ms / 2,000 ms
コード長 388 bytes
コンパイル時間 224 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 108,884 KB
最終ジャッジ日時 2024-04-18 23:19:33
合計ジャッジ時間 2,726 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
52,864 KB
testcase_01 AC 35 ms
52,224 KB
testcase_02 AC 36 ms
52,864 KB
testcase_03 AC 37 ms
52,096 KB
testcase_04 AC 36 ms
52,608 KB
testcase_05 AC 38 ms
52,736 KB
testcase_06 AC 38 ms
52,736 KB
testcase_07 AC 37 ms
52,736 KB
testcase_08 AC 37 ms
52,864 KB
testcase_09 AC 35 ms
52,992 KB
testcase_10 AC 42 ms
59,136 KB
testcase_11 AC 42 ms
59,008 KB
testcase_12 AC 49 ms
63,616 KB
testcase_13 AC 48 ms
63,360 KB
testcase_14 AC 64 ms
76,412 KB
testcase_15 AC 59 ms
73,216 KB
testcase_16 AC 118 ms
89,272 KB
testcase_17 AC 156 ms
101,796 KB
testcase_18 AC 181 ms
108,884 KB
testcase_19 AC 176 ms
108,488 KB
testcase_20 AC 178 ms
108,616 KB
testcase_21 AC 175 ms
108,312 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