結果

問題 No.210 探し物はどこですか?
ユーザー srjywrdnprktsrjywrdnprkt
提出日時 2023-01-15 18:12:26
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 826 bytes
コンパイル時間 992 ms
コンパイル使用メモリ 114,660 KB
実行使用メモリ 7,752 KB
最終ジャッジ日時 2023-08-28 10:33:34
合計ジャッジ時間 6,779 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 504 ms
4,376 KB
testcase_01 AC 608 ms
4,380 KB
testcase_02 AC 649 ms
4,376 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
#include <cassert>

using namespace std;

int main(){

    int N, idx;
    long double ans=0, pr;
    cin >> N;
    vector<long double> p(N), q(N);
    for (int i=0; i<N; i++){
        cin >> p[i]; p[i] /= 1000;
    }
    for (int i=0; i<N; i++){
        cin >> q[i]; q[i] /= 100;
    }

    priority_queue<pair<long double, int>> que;
    for (int i=0; i<N; i++){
        que.push({p[i]*q[i], i});
    }

    for (int i=1; i<=5000000; i++){
        tie(pr, idx) = que.top();
        que.pop();
        ans += pr * i;
        que.push({pr*(1.0-q[idx]), idx});
    }

    cout << setprecision(18) << ans << endl;

    return 0;
}
0