結果

問題 No.210 探し物はどこですか?
ユーザー ctyl_0ctyl_0
提出日時 2015-09-29 00:15:35
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 143 ms / 2,000 ms
コード長 1,298 bytes
コンパイル時間 1,006 ms
コンパイル使用メモリ 89,140 KB
実行使用メモリ 12,608 KB
最終ジャッジ日時 2023-09-26 17:28:45
合計ジャッジ時間 4,543 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
4,380 KB
testcase_01 AC 50 ms
7,772 KB
testcase_02 AC 97 ms
11,416 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 3 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 3 ms
4,380 KB
testcase_08 AC 3 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 3 ms
4,380 KB
testcase_11 AC 3 ms
4,376 KB
testcase_12 AC 3 ms
4,376 KB
testcase_13 AC 13 ms
4,384 KB
testcase_14 AC 13 ms
4,380 KB
testcase_15 AC 13 ms
4,380 KB
testcase_16 AC 14 ms
4,376 KB
testcase_17 AC 13 ms
4,380 KB
testcase_18 AC 16 ms
4,380 KB
testcase_19 AC 15 ms
4,380 KB
testcase_20 AC 16 ms
4,380 KB
testcase_21 AC 15 ms
4,380 KB
testcase_22 AC 15 ms
4,380 KB
testcase_23 AC 68 ms
8,700 KB
testcase_24 AC 70 ms
7,932 KB
testcase_25 AC 68 ms
8,088 KB
testcase_26 AC 68 ms
7,552 KB
testcase_27 AC 71 ms
7,964 KB
testcase_28 AC 64 ms
7,952 KB
testcase_29 AC 64 ms
8,340 KB
testcase_30 AC 64 ms
8,816 KB
testcase_31 AC 64 ms
8,424 KB
testcase_32 AC 64 ms
7,356 KB
testcase_33 AC 139 ms
12,580 KB
testcase_34 AC 141 ms
11,748 KB
testcase_35 AC 140 ms
11,532 KB
testcase_36 AC 143 ms
12,276 KB
testcase_37 AC 135 ms
12,428 KB
testcase_38 AC 112 ms
11,700 KB
testcase_39 AC 115 ms
12,152 KB
testcase_40 AC 118 ms
11,592 KB
testcase_41 AC 113 ms
11,996 KB
testcase_42 AC 111 ms
12,608 KB
testcase_43 AC 2 ms
4,376 KB
testcase_44 AC 2 ms
4,380 KB
testcase_45 AC 3 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

using namespace std;


int inputValue(){
    int a;
    cin >> a;
    return a;
};

template <typename T>
void output(T a, int precision) {
    if(precision > 0){
        cout << fixed << setprecision(precision)  << a << "\n";
    }
    else{
        cout << a << "\n";
    }
}

int main() {
    
    // source code
    int N = inputValue();
    vector<double> P(N), Q(N);
    
    rep(i, N){
        P[i] = (double)inputValue() / 1000.0;
    }
    rep(i, N){
        Q[i] = (double)inputValue() / 100.0;
    }
    
    priority_queue<double> pq;
    
    vector<double> R(N);
    rep(j, N){
        R[j] = P[j] * Q[j];
        pq.push(R[j]);
    }
    
    rep(i, 1000){
        rep(j, N){
            pq.push(R[j] * (1 - Q[j]));
            R[j] = R[j] * (1 - Q[j]);
        }
    }
    
    int cnt = 1;
    double ret = 0;
    while (!pq.empty()) {
        double t = pq.top();
        pq.pop();
        
        ret += t * cnt;
        cnt++;
    }
    
    output(ret, 5);
    
    return 0;
}
0