結果

問題 No.210 探し物はどこですか?
ユーザー nebukuro09nebukuro09
提出日時 2017-06-02 13:52:48
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 1,194 ms / 2,000 ms
コード長 724 bytes
コンパイル時間 2,288 ms
コンパイル使用メモリ 181,080 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-03 13:54:04
合計ジャッジ時間 21,998 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 256 ms
4,380 KB
testcase_01 AC 340 ms
4,384 KB
testcase_02 AC 374 ms
4,376 KB
testcase_03 AC 1,091 ms
4,376 KB
testcase_04 AC 195 ms
4,376 KB
testcase_05 AC 220 ms
4,376 KB
testcase_06 AC 1,053 ms
4,380 KB
testcase_07 AC 210 ms
4,380 KB
testcase_08 AC 175 ms
4,380 KB
testcase_09 AC 176 ms
4,380 KB
testcase_10 AC 178 ms
4,376 KB
testcase_11 AC 175 ms
4,380 KB
testcase_12 AC 176 ms
4,384 KB
testcase_13 AC 352 ms
4,376 KB
testcase_14 AC 334 ms
4,380 KB
testcase_15 AC 333 ms
4,380 KB
testcase_16 AC 355 ms
4,380 KB
testcase_17 AC 332 ms
4,504 KB
testcase_18 AC 299 ms
4,376 KB
testcase_19 AC 298 ms
4,376 KB
testcase_20 AC 296 ms
4,376 KB
testcase_21 AC 298 ms
4,380 KB
testcase_22 AC 299 ms
4,380 KB
testcase_23 AC 444 ms
4,376 KB
testcase_24 AC 434 ms
4,380 KB
testcase_25 AC 433 ms
4,376 KB
testcase_26 AC 439 ms
4,380 KB
testcase_27 AC 443 ms
4,376 KB
testcase_28 AC 378 ms
4,380 KB
testcase_29 AC 380 ms
4,384 KB
testcase_30 AC 378 ms
4,376 KB
testcase_31 AC 380 ms
4,384 KB
testcase_32 AC 379 ms
4,380 KB
testcase_33 AC 483 ms
4,380 KB
testcase_34 AC 481 ms
4,376 KB
testcase_35 AC 480 ms
4,380 KB
testcase_36 AC 484 ms
4,376 KB
testcase_37 AC 479 ms
4,380 KB
testcase_38 AC 412 ms
4,380 KB
testcase_39 AC 412 ms
4,380 KB
testcase_40 AC 410 ms
4,380 KB
testcase_41 AC 416 ms
4,380 KB
testcase_42 AC 414 ms
4,376 KB
testcase_43 AC 73 ms
4,376 KB
testcase_44 AC 133 ms
4,380 KB
testcase_45 AC 1,194 ms
4,376 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;

    auto pq = new BinaryHeap!(Array!(Tuple!(real, int)), "a[0] < b[0]");
    foreach (i; 0..N) pq.insert(tuple(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[0];
        pq.replaceFront(tuple(t[0] * (1 - Q[t[1]]), t[1]));
    }

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