結果

問題 No.210 探し物はどこですか?
ユーザー koyumeishikoyumeishi
提出日時 2015-05-16 01:07:20
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 186 ms / 2,000 ms
コード長 870 bytes
コンパイル時間 669 ms
コンパイル使用メモリ 81,320 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-20 08:58:41
合計ジャッジ時間 7,805 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
4,380 KB
testcase_01 AC 96 ms
4,376 KB
testcase_02 AC 101 ms
4,376 KB
testcase_03 AC 142 ms
4,376 KB
testcase_04 AC 136 ms
4,376 KB
testcase_05 AC 135 ms
4,376 KB
testcase_06 AC 141 ms
4,376 KB
testcase_07 AC 137 ms
4,376 KB
testcase_08 AC 97 ms
4,380 KB
testcase_09 AC 101 ms
4,380 KB
testcase_10 AC 101 ms
4,376 KB
testcase_11 AC 111 ms
4,376 KB
testcase_12 AC 113 ms
4,380 KB
testcase_13 AC 109 ms
4,380 KB
testcase_14 AC 139 ms
4,376 KB
testcase_15 AC 173 ms
4,380 KB
testcase_16 AC 135 ms
4,380 KB
testcase_17 AC 186 ms
4,380 KB
testcase_18 AC 80 ms
4,380 KB
testcase_19 AC 84 ms
4,376 KB
testcase_20 AC 84 ms
4,380 KB
testcase_21 AC 84 ms
4,376 KB
testcase_22 AC 84 ms
4,376 KB
testcase_23 AC 110 ms
4,376 KB
testcase_24 AC 112 ms
4,380 KB
testcase_25 AC 114 ms
4,376 KB
testcase_26 AC 115 ms
4,380 KB
testcase_27 AC 115 ms
4,380 KB
testcase_28 AC 124 ms
4,380 KB
testcase_29 AC 125 ms
4,380 KB
testcase_30 AC 124 ms
4,380 KB
testcase_31 AC 125 ms
4,376 KB
testcase_32 AC 125 ms
4,380 KB
testcase_33 AC 136 ms
4,376 KB
testcase_34 AC 134 ms
4,376 KB
testcase_35 AC 138 ms
4,376 KB
testcase_36 AC 136 ms
4,376 KB
testcase_37 AC 136 ms
4,376 KB
testcase_38 AC 133 ms
4,380 KB
testcase_39 AC 133 ms
4,380 KB
testcase_40 AC 133 ms
4,376 KB
testcase_41 AC 134 ms
4,376 KB
testcase_42 AC 133 ms
4,376 KB
testcase_43 AC 20 ms
4,376 KB
testcase_44 AC 45 ms
4,380 KB
testcase_45 AC 144 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cstdio>
#include <sstream>
#include <map>
#include <string>
#include <algorithm>
#include <queue>
#include <cmath>
#include <set>
using namespace std;

int main(){
	int n;
	cin >> n;
	vector<double> p(n), q(n);
	const double p_ = 1.0/1000;
	const double q_ = 1.0/100;

	for(int i=0; i<n; i++){
		int tmp;
		cin >> tmp;
		p[i] = tmp * p_;
	}
	for(int i=0; i<n; i++){
		int tmp;
		cin >> tmp;
		q[i] = tmp * q_;
	}

	double ans = 0.0;

	priority_queue<pair<double, pair<double,int>>> pq;
	for(int i=0; i<n; i++){
		pq.push({p[i] * q[i], {p[i], i}});
	}

	for(int i=1; i<=1000000; ++i){
		auto val = pq.top(); pq.pop();
		ans += i * val.first;
		double p_next = val.second.first * (1.0 - q[val.second.second]);
		pq.push({p_next * q[val.second.second], {p_next, val.second.second}});
	}

	printf("%.16f\n", ans);
	return 0;
}
0