結果

問題 No.210 探し物はどこですか?
ユーザー parukiparuki
提出日時 2016-08-20 13:32:55
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 1,604 ms / 2,000 ms
コード長 1,128 bytes
コンパイル時間 1,680 ms
コンパイル使用メモリ 174,232 KB
実行使用メモリ 4,512 KB
最終ジャッジ日時 2023-08-07 17:12:31
合計ジャッジ時間 63,539 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 960 ms
4,384 KB
testcase_01 AC 838 ms
4,380 KB
testcase_02 AC 869 ms
4,380 KB
testcase_03 AC 1,382 ms
4,380 KB
testcase_04 AC 1,363 ms
4,384 KB
testcase_05 AC 1,356 ms
4,380 KB
testcase_06 AC 1,364 ms
4,380 KB
testcase_07 AC 1,355 ms
4,380 KB
testcase_08 AC 1,338 ms
4,380 KB
testcase_09 AC 1,340 ms
4,380 KB
testcase_10 AC 1,334 ms
4,380 KB
testcase_11 AC 1,354 ms
4,380 KB
testcase_12 AC 1,349 ms
4,380 KB
testcase_13 AC 1,453 ms
4,380 KB
testcase_14 AC 1,503 ms
4,380 KB
testcase_15 AC 1,507 ms
4,380 KB
testcase_16 AC 1,476 ms
4,384 KB
testcase_17 AC 1,498 ms
4,384 KB
testcase_18 AC 1,212 ms
4,380 KB
testcase_19 AC 1,220 ms
4,380 KB
testcase_20 AC 1,254 ms
4,384 KB
testcase_21 AC 1,228 ms
4,384 KB
testcase_22 AC 1,236 ms
4,380 KB
testcase_23 AC 1,533 ms
4,384 KB
testcase_24 AC 1,566 ms
4,384 KB
testcase_25 AC 1,604 ms
4,380 KB
testcase_26 AC 1,561 ms
4,380 KB
testcase_27 AC 1,536 ms
4,384 KB
testcase_28 AC 1,153 ms
4,380 KB
testcase_29 AC 1,168 ms
4,380 KB
testcase_30 AC 1,167 ms
4,384 KB
testcase_31 AC 1,155 ms
4,380 KB
testcase_32 AC 1,158 ms
4,512 KB
testcase_33 AC 1,594 ms
4,388 KB
testcase_34 AC 1,563 ms
4,380 KB
testcase_35 AC 1,604 ms
4,380 KB
testcase_36 AC 1,604 ms
4,380 KB
testcase_37 AC 1,562 ms
4,380 KB
testcase_38 AC 1,214 ms
4,384 KB
testcase_39 AC 1,215 ms
4,380 KB
testcase_40 AC 1,198 ms
4,380 KB
testcase_41 AC 1,220 ms
4,380 KB
testcase_42 AC 1,211 ms
4,380 KB
testcase_43 AC 143 ms
4,384 KB
testcase_44 AC 283 ms
4,384 KB
testcase_45 AC 1,374 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;

int N;
vector<double> p, q;

void solve(){
    rep(i, N)p[i] *= 0.001;
    rep(i, N)q[i] *= 0.01;
    int cnt = 0;

    priority_queue<pair<double, int> > Q;
    rep(i, N)Q.push(mp(p[i] * q[i], i));

    double ans = 0;
    rep(iter_, 10000000){
        double x;
        int k;
        tie(x, k) = Q.top();
        Q.pop();
        Q.push(mp(x*(1 - q[k]), k));
        ans += x * ++cnt;
    }

    cout << setprecision(20) << ans << endl;
}

int main(){
    while(cin >> N){
        p.resize(N);
        q.resize(N);
        rep(i, N)scanf("%lf", &p[i]);
        rep(i, N)scanf("%lf", &q[i]);
        solve();
    }
}
0