結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 3 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 3 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 3 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 3 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 6 ms
4,380 KB
testcase_14 AC 6 ms
4,380 KB
testcase_15 AC 6 ms
4,380 KB
testcase_16 AC 6 ms
4,380 KB
testcase_17 AC 6 ms
4,380 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 AC 2 ms
4,380 KB
testcase_44 AC 3 ms
4,376 KB
testcase_45 AC 2 ms
4,384 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 >= 10000){
        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