結果
| 問題 |
No.1173 Endangered Species
|
| コンテスト | |
| ユーザー |
anagohirame
|
| 提出日時 | 2020-08-14 23:18:55 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 462 bytes |
| コンパイル時間 | 88 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 74,576 KB |
| 最終ジャッジ日時 | 2024-10-10 16:44:41 |
| 合計ジャッジ時間 | 6,738 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 RE * 1 TLE * 1 |
| other | AC * 2 RE * 11 TLE * 1 -- * 5 |
ソースコード
from math import log from scipy import optimize 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((1-q[i]) / (1-q[i]*x) for i in range(n)) - x def f_prime(x): return sum((1/q[i] - 1) / ((1/q[i] - x)**2) for i in range(n)) - 1 r = optimize.newton(f, 0, fprime=f_prime) #print(r) ans = 0 for i in range(n): ans += a[i] * log((1-q[i]) / (1-q[i]*r)) print(ans)
anagohirame