結果
問題 | No.1173 Endangered Species |
ユーザー | cookiedoth |
提出日時 | 2020-08-14 23:09:35 |
言語 | C++17 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 113 ms / 2,000 ms |
コード長 | 3,066 bytes |
コンパイル時間 | 1,359 ms |
コンパイル使用メモリ | 130,896 KB |
実行使用メモリ | 8,960 KB |
最終ジャッジ日時 | 2024-04-18 23:02:35 |
合計ジャッジ時間 | 2,663 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
8,040 KB |
testcase_01 | AC | 2 ms
6,820 KB |
testcase_02 | AC | 3 ms
6,816 KB |
testcase_03 | AC | 3 ms
7,912 KB |
testcase_04 | AC | 3 ms
8,036 KB |
testcase_05 | AC | 3 ms
6,944 KB |
testcase_06 | AC | 2 ms
6,940 KB |
testcase_07 | AC | 2 ms
6,944 KB |
testcase_08 | AC | 2 ms
6,940 KB |
testcase_09 | AC | 3 ms
6,944 KB |
testcase_10 | AC | 2 ms
6,944 KB |
testcase_11 | AC | 2 ms
7,912 KB |
testcase_12 | AC | 2 ms
6,940 KB |
testcase_13 | AC | 3 ms
6,940 KB |
testcase_14 | AC | 10 ms
6,948 KB |
testcase_15 | AC | 8 ms
6,948 KB |
testcase_16 | AC | 61 ms
7,848 KB |
testcase_17 | AC | 91 ms
8,448 KB |
testcase_18 | AC | 113 ms
8,960 KB |
testcase_19 | AC | 111 ms
8,816 KB |
testcase_20 | AC | 112 ms
8,816 KB |
testcase_21 | AC | 112 ms
8,936 KB |
ソースコード
/* Code for problem F by cookiedoth Generated 14 Aug 2020 at 04.58 PM ──────▄▌▐▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▌ ───▄▄██▌█░ВЕЗЁМ▄▀▀▀▄░ГУСЕЙ░░░░░░░ ───████▌█▄███▀░◐░▄▀▀▀▄░░РАБОТЯГИ░ ──██░░█▌█░░▄███▀░◐░░▄▀▀▀▄░░░░░░░ ─██░░░█▌█░░░░▐░▄▀▀▀▌░░░░◐░▀███▄░ ▄██████▌█▄███▀░◐░░░▌░░░░░▐░░░░░░ ███████▌█░░░░▌░░░░░▌░░░░░▐░░░░░░ ███████▌█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▌ ▀(@)▀▀▀▀▀▀▀(@)(@)▀▀▀▀▀▀▀▀▀▀▀▀▀(@)▀(@) =_= ¯\_(ツ)_/¯ ^_^ */ #include <iostream> #include <fstream> #include <vector> #include <set> #include <map> #include <bitset> #include <algorithm> #include <iomanip> #include <cmath> #include <ctime> #include <functional> #include <unordered_set> #include <unordered_map> #include <string> #include <queue> #include <deque> #include <stack> #include <complex> #include <cassert> #include <random> #include <cstring> #include <numeric> #define ll long long #define ld long double #define null NULL #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() #define debug(a) cerr << #a << " = " << a << endl #define forn(i, n) for (int i = 0; i < n; ++i) #define sz(a) (int)a.size() using namespace std; template<class T> int chkmax(T &a, T b) { if (b > a) { a = b; return 1; } return 0; } template<class T> int chkmin(T &a, T b) { if (b < a) { a = b; return 1; } return 0; } template<class iterator> void output(iterator begin, iterator end, ostream& out = cerr) { while (begin != end) { out << (*begin) << " "; begin++; } out << endl; } template<class T> void output(T x, ostream& out = cerr) { output(x.begin(), x.end(), out); } void fast_io() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } const int mx = 1e5 + 228; int n; ld p[mx], q[mx], t[mx]; int A[mx]; void read() { cin >> n; for (int i = 0; i < n; ++i) { cin >> p[i]; } for (int i = 0; i < n; ++i) { cin >> q[i]; } for (int i = 0; i < n; ++i) { cin >> A[i]; } } int check(ld tb) { ld tb2 = 0; for (int i = 0; i < n; ++i) { t[i] = (1.0 - q[i]) / (1.0 - q[i] * tb); tb2 += p[i] * t[i]; } // cerr << "tb/tb2 " << tb << " " << tb2 << endl; return (tb < tb2); } void solve() { ld l = 0, r = 1; for (int it = 0; it < 80; ++it) { ld mid = (l + r) / 2; if (check(mid)) { l = mid; } else { r = mid; } } check(l); // cout << l << '\n'; } signed main() { fast_io(); read(); // for (ld i = 0.0; i <= 1.0; i += 0.01) { // check(i); // } solve(); ld ans = 0.0; for (int i = 0; i < n; ++i) { ans += logl(t[i]) * (ld)A[i]; } cout << setprecision(10) << fixed << ans << '\n'; }