結果

問題 No.210 探し物はどこですか?
ユーザー kimiyukikimiyuki
提出日時 2016-09-15 23:59:13
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 226 ms / 2,000 ms
コード長 1,749 bytes
コンパイル時間 767 ms
コンパイル使用メモリ 74,152 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-08-10 20:45:36
合計ジャッジ時間 3,978 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
4,380 KB
testcase_01 AC 105 ms
4,380 KB
testcase_02 AC 226 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,384 KB
testcase_08 AC 3 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 3 ms
4,380 KB
testcase_14 AC 3 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 13 ms
4,380 KB
testcase_19 AC 14 ms
4,380 KB
testcase_20 AC 13 ms
4,376 KB
testcase_21 AC 13 ms
4,380 KB
testcase_22 AC 13 ms
4,376 KB
testcase_23 AC 8 ms
4,380 KB
testcase_24 AC 6 ms
4,380 KB
testcase_25 AC 7 ms
4,380 KB
testcase_26 AC 7 ms
4,384 KB
testcase_27 AC 10 ms
4,376 KB
testcase_28 AC 65 ms
4,380 KB
testcase_29 AC 63 ms
4,380 KB
testcase_30 AC 64 ms
4,380 KB
testcase_31 AC 66 ms
4,384 KB
testcase_32 AC 64 ms
4,380 KB
testcase_33 AC 14 ms
4,376 KB
testcase_34 AC 14 ms
4,380 KB
testcase_35 AC 13 ms
4,380 KB
testcase_36 AC 15 ms
4,380 KB
testcase_37 AC 14 ms
4,384 KB
testcase_38 AC 128 ms
4,376 KB
testcase_39 AC 120 ms
4,388 KB
testcase_40 AC 126 ms
4,380 KB
testcase_41 AC 118 ms
4,376 KB
testcase_42 AC 124 ms
4,376 KB
testcase_43 AC 1 ms
4,380 KB
testcase_44 AC 1 ms
4,380 KB
testcase_45 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <vector>
#include <algorithm>
#include <array>
#include <set>
#include <map>
#include <queue>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <functional>
#include <cassert>
#define repeat(i,n) for (int i = 0; (i) < (n); ++(i))
#define repeat_from(i,m,n) for (int i = (m); (i) < (n); ++(i))
#define repeat_reverse(i,n) for (int i = (n)-1; (i) >= 0; --(i))
#define repeat_from_reverse(i,m,n) for (int i = (n)-1; (i) >= (m); --(i))
#define whole(f,x,...) ([&](decltype((x)) y) { return (f)(begin(y), end(y), ## __VA_ARGS__); })(x)
typedef long long ll;
using namespace std;
template <class T> void setmax(T & a, T const & b) { if (a < b) a = b; }
template <class T> void setmin(T & a, T const & b) { if (b < a) a = b; }
template <typename T, typename X> auto vectors(T a, X x) { return vector<T>(x, a); }
template <typename T, typename X, typename Y, typename... Zs> auto vectors(T a, X x, Y y, Zs... zs) { auto cont = vectors(a, y, zs...); return vector<decltype(cont)>(x, cont); }
int main() {
    // input
    int n; scanf("%d", &n);
    vector<int> p(n); repeat (i,n) scanf("%d", &p[i]);
    vector<int> q(n); repeat (i,n) scanf("%d", &q[i]);
    // compute
    vector<long double> r(n); repeat (i,n) r[i] = (p[i] / 1000.) * (q[i] / 100.);
    auto cmp = [&](int i, int j) { return r[i] < r[j]; };
    priority_queue<int, vector<int>, decltype(cmp)> que(cmp);
    repeat (i,n) que.push(i);
    long double ans = 0;
    const long double eps = 1e-16;
    for (int k = 1; ; ++ k) {
        int i = que.top(); que.pop();
        if (r[i] < eps) break;
        ans += k * r[i];
        r[i] *= 1 - q[i] / 100.;
        que.push(i);
    }
    // output
    printf("%.6Lf\n", ans);
    return 0;
}
0