結果

問題 No.210 探し物はどこですか?
ユーザー tottoripapertottoripaper
提出日時 2019-03-09 00:58:14
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 955 bytes
コンパイル時間 1,453 ms
コンパイル使用メモリ 163,552 KB
実行使用メモリ 6,240 KB
最終ジャッジ日時 2023-09-05 19:47:42
合計ジャッジ時間 9,292 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
6,016 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 8 ms
6,140 KB
testcase_04 AC 12 ms
6,012 KB
testcase_05 AC 8 ms
6,016 KB
testcase_06 AC 8 ms
6,044 KB
testcase_07 AC 12 ms
6,036 KB
testcase_08 AC 8 ms
6,036 KB
testcase_09 AC 8 ms
6,152 KB
testcase_10 AC 12 ms
6,040 KB
testcase_11 AC 7 ms
6,128 KB
testcase_12 AC 13 ms
6,176 KB
testcase_13 AC 38 ms
6,040 KB
testcase_14 AC 39 ms
6,164 KB
testcase_15 AC 39 ms
6,040 KB
testcase_16 AC 38 ms
6,040 KB
testcase_17 AC 39 ms
6,100 KB
testcase_18 AC 39 ms
6,036 KB
testcase_19 AC 39 ms
6,048 KB
testcase_20 AC 39 ms
6,208 KB
testcase_21 AC 39 ms
6,240 KB
testcase_22 AC 39 ms
6,212 KB
testcase_23 AC 174 ms
6,048 KB
testcase_24 AC 174 ms
6,100 KB
testcase_25 AC 174 ms
6,108 KB
testcase_26 AC 174 ms
6,148 KB
testcase_27 AC 175 ms
6,160 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 343 ms
6,156 KB
testcase_34 AC 344 ms
6,052 KB
testcase_35 AC 343 ms
6,208 KB
testcase_36 AC 342 ms
6,060 KB
testcase_37 AC 347 ms
6,156 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 AC 5 ms
6,016 KB
testcase_44 AC 8 ms
6,136 KB
testcase_45 AC 42 ms
6,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int N;
double p[1000], q[1000], r[1000];

double rec(int t){
    if(t >= 80000){
        return 0;
    }

    int i = std::max_element(r, r + N) - r;
    double ri = r[i];

    if(ri == 1){
        return 1;
    }

    for(int j=0;j<N;++j){
        r[j] *= 1.0 / (1.0 - ri);
    }

    r[i] *= (1.0 - q[i]);

    return 1.0 + (1.0 - ri) * rec(t + 1);
}

int main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    std::cin >> N;

    for(int i=0;i<N;++i){
        std::cin >> p[i];
        p[i] *= 1e-3;
    }

    for(int i=0;i<N;++i){
        std::cin >> q[i];
        q[i] *= 1e-2;
    }

    for(int i=0;i<N;++i){
        r[i] = p[i] * q[i];
    }

    double e = rec(0);
    printf("%.5f\n", e);
}
0