結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 304 ms
4,380 KB
testcase_01 AC 377 ms
4,380 KB
testcase_02 AC 407 ms
4,380 KB
testcase_03 AC 1,808 ms
4,376 KB
testcase_04 AC 215 ms
4,384 KB
testcase_05 AC 246 ms
4,380 KB
testcase_06 AC 1,993 ms
4,380 KB
testcase_07 AC 236 ms
4,376 KB
testcase_08 AC 187 ms
4,376 KB
testcase_09 AC 189 ms
4,376 KB
testcase_10 AC 190 ms
4,376 KB
testcase_11 AC 187 ms
4,376 KB
testcase_12 AC 188 ms
4,384 KB
testcase_13 AC 427 ms
4,376 KB
testcase_14 AC 404 ms
4,376 KB
testcase_15 AC 400 ms
4,504 KB
testcase_16 AC 428 ms
4,380 KB
testcase_17 AC 395 ms
4,376 KB
testcase_18 AC 352 ms
4,380 KB
testcase_19 AC 354 ms
4,380 KB
testcase_20 AC 355 ms
4,380 KB
testcase_21 AC 354 ms
4,380 KB
testcase_22 AC 355 ms
4,376 KB
testcase_23 AC 543 ms
4,376 KB
testcase_24 AC 527 ms
4,376 KB
testcase_25 AC 527 ms
4,384 KB
testcase_26 AC 537 ms
4,380 KB
testcase_27 AC 543 ms
4,380 KB
testcase_28 AC 451 ms
4,380 KB
testcase_29 AC 452 ms
4,380 KB
testcase_30 AC 452 ms
4,380 KB
testcase_31 AC 452 ms
4,376 KB
testcase_32 AC 450 ms
4,380 KB
testcase_33 AC 601 ms
4,384 KB
testcase_34 AC 599 ms
4,376 KB
testcase_35 AC 595 ms
4,376 KB
testcase_36 AC 602 ms
4,380 KB
testcase_37 AC 603 ms
4,376 KB
testcase_38 AC 499 ms
4,380 KB
testcase_39 AC 499 ms
4,380 KB
testcase_40 AC 494 ms
4,380 KB
testcase_41 AC 498 ms
4,380 KB
testcase_42 AC 497 ms
4,380 KB
testcase_43 AC 46 ms
4,376 KB
testcase_44 AC 224 ms
4,376 KB
testcase_45 AC 1,921 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 = N.iota.map!(i => tuple(P[i] * Q[i], i)).array.heapify!"a < b";

    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