結果

問題 No.210 探し物はどこですか?
ユーザー nebukuro09nebukuro09
提出日時 2017-06-02 13:50:02
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 1,167 ms / 2,000 ms
コード長 735 bytes
コンパイル時間 2,236 ms
コンパイル使用メモリ 176,260 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-09-03 13:53:13
合計ジャッジ時間 19,749 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 199 ms
4,376 KB
testcase_01 AC 270 ms
4,380 KB
testcase_02 AC 299 ms
4,380 KB
testcase_03 AC 1,063 ms
4,384 KB
testcase_04 AC 160 ms
4,380 KB
testcase_05 AC 179 ms
4,376 KB
testcase_06 AC 1,024 ms
4,380 KB
testcase_07 AC 172 ms
4,380 KB
testcase_08 AC 148 ms
4,380 KB
testcase_09 AC 148 ms
4,376 KB
testcase_10 AC 148 ms
4,380 KB
testcase_11 AC 146 ms
4,376 KB
testcase_12 AC 147 ms
4,384 KB
testcase_13 AC 287 ms
4,380 KB
testcase_14 AC 275 ms
4,380 KB
testcase_15 AC 273 ms
4,376 KB
testcase_16 AC 290 ms
4,380 KB
testcase_17 AC 274 ms
4,376 KB
testcase_18 AC 247 ms
4,384 KB
testcase_19 AC 247 ms
4,376 KB
testcase_20 AC 245 ms
4,380 KB
testcase_21 AC 247 ms
4,388 KB
testcase_22 AC 249 ms
4,376 KB
testcase_23 AC 364 ms
4,376 KB
testcase_24 AC 356 ms
4,380 KB
testcase_25 AC 358 ms
4,380 KB
testcase_26 AC 363 ms
4,380 KB
testcase_27 AC 362 ms
4,380 KB
testcase_28 AC 309 ms
4,384 KB
testcase_29 AC 310 ms
4,384 KB
testcase_30 AC 310 ms
4,376 KB
testcase_31 AC 311 ms
4,376 KB
testcase_32 AC 309 ms
4,380 KB
testcase_33 AC 399 ms
4,376 KB
testcase_34 AC 397 ms
4,380 KB
testcase_35 AC 396 ms
4,380 KB
testcase_36 AC 400 ms
4,384 KB
testcase_37 AC 394 ms
4,384 KB
testcase_38 AC 332 ms
4,384 KB
testcase_39 AC 332 ms
4,376 KB
testcase_40 AC 333 ms
4,376 KB
testcase_41 AC 335 ms
4,380 KB
testcase_42 AC 334 ms
4,380 KB
testcase_43 AC 65 ms
4,380 KB
testcase_44 AC 111 ms
4,380 KB
testcase_45 AC 1,167 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;


void main() {
    auto N = readln.chomp.to!int;
    auto P = readln.split.map!(x => x.to!real / 1000).array;
    auto Q = readln.split.map!(x => x.to!real / 100).array;

    struct Hoge{real p; int i;}
    auto pq = new BinaryHeap!(Array!Hoge, "a.p < b.p");
    foreach (i; 0..N) pq.insert(Hoge(P[i] * Q[i], i));

    real ans = 0;
    
    const int TRY = 10^^6;
    foreach (i; 1..TRY+1) {
        auto t = pq.front;
        ans += i * t.p;
        pq.replaceFront(Hoge(t.p * (1 - Q[t.i]), t.i));
    }

    writefln("%.9f", ans);
}


0