結果
問題 | No.210 探し物はどこですか? |
ユーザー |
![]() |
提出日時 | 2015-05-16 00:26:28 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 120 ms / 2,000 ms |
コード長 | 968 bytes |
コンパイル時間 | 1,440 ms |
コンパイル使用メモリ | 163,960 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-06 04:37:24 |
合計ジャッジ時間 | 6,823 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 43 |
ソースコード
#include <bits/stdc++.h> #define rep(i, n) for (int (i) = 0; (i) < (int)(n); (i)++) const int dx[] = {1, 0, -1, 0}; const int dy[] = {0, 1, 0, -1}; using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll; typedef pair<int, int> pii; double p[1111], q[1111], r[1111]; int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; for (int i = 0; i < n; i++) { cin >> p[i]; p[i] /= 1000.; } for (int i = 0; i < n; i++) { cin >> q[i]; q[i] /= 100.; } priority_queue<pair<double, int> > que; for (int i = 0; i < n; i++) { que.push(make_pair(p[i]*q[i], i)); } double ans = 0; for (int i = 1; i < 1000000; i++) { auto now = que.top(); que.pop(); ans += now.first * i; double next = now.first * (1-q[now.second]); que.push(make_pair(next, now.second)); } printf("%.10lf\n", ans); return 0; }