結果
| 問題 |
No.210 探し物はどこですか?
|
| コンテスト | |
| ユーザー |
koyumeishi
|
| 提出日時 | 2015-05-16 01:06:55 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 868 bytes |
| コンパイル時間 | 729 ms |
| コンパイル使用メモリ | 81,740 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-06 04:37:46 |
| 合計ジャッジ時間 | 2,235 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 WA * 17 |
ソースコード
#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<=50000; ++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;
}
koyumeishi