結果
| 問題 |
No.1173 Endangered Species
|
| コンテスト | |
| ユーザー |
risujiroh
|
| 提出日時 | 2020-08-14 23:22:29 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 751 bytes |
| コンパイル時間 | 4,891 ms |
| コンパイル使用メモリ | 248,552 KB |
| 最終ジャッジ日時 | 2025-01-13 00:45:40 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | AC * 10 WA * 9 |
ソースコード
#include <bits/extc++.h>
#ifndef DUMP
#define DUMP(...) (void)0
#endif
using namespace std;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
cout << fixed << setprecision(20);
int n;
cin >> n;
vector<double> p(n), q(n);
for (auto&& e : p) cin >> e;
for (auto&& e : q) cin >> e;
auto chk = [&](double m) {
double sum = 0;
for (int i = 0; i < n; ++i) {
sum += p[i] * (1 - q[i]) / (1 - q[i] * m);
}
return sum > m;
};
double ok = 0, ng = 1;
for (int _ = 100; _--;) {
double mid = (ok + ng) / 2;
(chk(mid) ? ok : ng) = mid;
}
DUMP(ok);
double res = 1;
for (int i = 0; i < n; ++i) {
int a;
cin >> a;
res += log((1 - q[i]) / (1 - q[i] * ok)) * a;
}
cout << res << '\n';
}
risujiroh