結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
8,164 KB
testcase_01 AC 261 ms
36,808 KB
testcase_02 AC 519 ms
69,568 KB
testcase_03 AC 9 ms
4,376 KB
testcase_04 AC 7 ms
4,376 KB
testcase_05 AC 9 ms
4,376 KB
testcase_06 AC 7 ms
4,376 KB
testcase_07 AC 7 ms
4,380 KB
testcase_08 AC 7 ms
4,380 KB
testcase_09 AC 8 ms
4,380 KB
testcase_10 AC 8 ms
4,376 KB
testcase_11 AC 7 ms
4,380 KB
testcase_12 AC 8 ms
4,380 KB
testcase_13 AC 67 ms
8,360 KB
testcase_14 AC 67 ms
8,592 KB
testcase_15 AC 67 ms
8,188 KB
testcase_16 AC 64 ms
8,064 KB
testcase_17 AC 68 ms
7,364 KB
testcase_18 AC 76 ms
7,828 KB
testcase_19 AC 73 ms
8,432 KB
testcase_20 AC 75 ms
7,756 KB
testcase_21 AC 75 ms
8,228 KB
testcase_22 AC 76 ms
8,544 KB
testcase_23 AC 408 ms
36,364 KB
testcase_24 AC 405 ms
35,980 KB
testcase_25 AC 431 ms
35,960 KB
testcase_26 AC 406 ms
37,192 KB
testcase_27 AC 438 ms
35,872 KB
testcase_28 AC 378 ms
36,164 KB
testcase_29 AC 380 ms
36,544 KB
testcase_30 AC 377 ms
36,048 KB
testcase_31 AC 375 ms
36,240 KB
testcase_32 AC 380 ms
36,196 KB
testcase_33 AC 855 ms
69,692 KB
testcase_34 AC 859 ms
69,672 KB
testcase_35 AC 857 ms
69,048 KB
testcase_36 AC 866 ms
70,528 KB
testcase_37 AC 838 ms
69,876 KB
testcase_38 AC 692 ms
70,096 KB
testcase_39 AC 680 ms
70,296 KB
testcase_40 AC 700 ms
69,344 KB
testcase_41 AC 687 ms
69,864 KB
testcase_42 AC 690 ms
69,120 KB
testcase_43 AC 2 ms
4,380 KB
testcase_44 AC 4 ms
4,380 KB
testcase_45 AC 8 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, 5000){
        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