結果

問題 No.210 探し物はどこですか?
ユーザー te-shte-sh
提出日時 2017-05-12 17:45:05
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 1,128 ms / 2,000 ms
コード長 577 bytes
コンパイル時間 2,182 ms
コンパイル使用メモリ 173,060 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-03 13:23:58
合計ジャッジ時間 18,264 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 180 ms
4,376 KB
testcase_01 AC 256 ms
4,376 KB
testcase_02 AC 289 ms
4,380 KB
testcase_03 AC 1,028 ms
4,376 KB
testcase_04 AC 139 ms
4,376 KB
testcase_05 AC 159 ms
4,380 KB
testcase_06 AC 988 ms
4,376 KB
testcase_07 AC 149 ms
4,376 KB
testcase_08 AC 125 ms
4,376 KB
testcase_09 AC 126 ms
4,376 KB
testcase_10 AC 126 ms
4,380 KB
testcase_11 AC 124 ms
4,376 KB
testcase_12 AC 126 ms
4,376 KB
testcase_13 AC 270 ms
4,380 KB
testcase_14 AC 256 ms
4,380 KB
testcase_15 AC 255 ms
4,376 KB
testcase_16 AC 272 ms
4,376 KB
testcase_17 AC 253 ms
4,376 KB
testcase_18 AC 223 ms
4,380 KB
testcase_19 AC 222 ms
4,376 KB
testcase_20 AC 221 ms
4,380 KB
testcase_21 AC 223 ms
4,380 KB
testcase_22 AC 224 ms
4,376 KB
testcase_23 AC 347 ms
4,376 KB
testcase_24 AC 336 ms
4,376 KB
testcase_25 AC 337 ms
4,380 KB
testcase_26 AC 341 ms
4,380 KB
testcase_27 AC 344 ms
4,380 KB
testcase_28 AC 291 ms
4,376 KB
testcase_29 AC 293 ms
4,380 KB
testcase_30 AC 293 ms
4,376 KB
testcase_31 AC 291 ms
4,380 KB
testcase_32 AC 292 ms
4,380 KB
testcase_33 AC 379 ms
4,380 KB
testcase_34 AC 377 ms
4,376 KB
testcase_35 AC 375 ms
4,380 KB
testcase_36 AC 380 ms
4,376 KB
testcase_37 AC 377 ms
4,376 KB
testcase_38 AC 320 ms
4,380 KB
testcase_39 AC 321 ms
4,380 KB
testcase_40 AC 320 ms
4,376 KB
testcase_41 AC 323 ms
4,376 KB
testcase_42 AC 321 ms
4,376 KB
testcase_43 AC 38 ms
4,380 KB
testcase_44 AC 91 ms
4,376 KB
testcase_45 AC 1,128 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.algorithm, std.conv, std.range, std.stdio, std.string;
import std.container; // SList, DList, BinaryHeap

void main()
{
  auto n = readln.chomp.to!size_t;
  auto pi = readln.split.to!(real[]).map!"a / 1000".array;
  auto qi = readln.split.to!(real[]).map!"a / 100".array;

  struct FP { real pq, qm; }
  auto hi = zip(pi, qi).map!(pq => FP(pq[0] * pq[1], 1 - pq[1])).array.heapify!"a.pq < b.pq";

  auto r = real(0);
  foreach (i; 1..1000000) {
    auto fp = hi.front;
    r += fp.pq * i;
    hi.replaceFront(FP(fp.pq * fp.qm, fp.qm));
  }

  writefln("%.4f", r);
}
0