結果

問題 No.475 最終日 - Writerの怠慢
ユーザー te-shte-sh
提出日時 2017-12-11 15:16:22
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 35 ms / 2,000 ms
コード長 594 bytes
コンパイル時間 5,064 ms
コンパイル使用メモリ 155,872 KB
実行使用メモリ 6,792 KB
最終ジャッジ日時 2023-09-03 17:26:40
合計ジャッジ時間 3,495 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 5 ms
4,376 KB
testcase_04 AC 35 ms
6,020 KB
testcase_05 AC 34 ms
6,484 KB
testcase_06 AC 34 ms
6,004 KB
testcase_07 AC 34 ms
6,172 KB
testcase_08 AC 35 ms
6,468 KB
testcase_09 AC 35 ms
6,296 KB
testcase_10 AC 35 ms
6,792 KB
testcase_11 AC 35 ms
6,560 KB
testcase_12 AC 17 ms
5,844 KB
testcase_13 AC 15 ms
5,808 KB
testcase_14 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  auto rd = readln.split.to!(int[]), n = rd[0], s = rd[1], w = rd[2];
  auto a = readln.split.to!(int[]);

  auto aw = a[w] + 100*s;
  a = a.remove(w).array;
  a.sort!"a > b";

  auto st = new int[](n-1);
  foreach (i; 0..n-1) st[i] = 50*s + 500*s/(8+2*(i+1));
  st.reverse();

  auto ans = 1.0L;
  foreach (i; 0..n-1) {
    auto r = st.assumeSorted!"a <= b".lowerBound(aw - a[i]).length;
    if (r < i) {
      writeln(0);
      return;
    }
    ans *= (r-i).to!real / (n-i-1);
  }

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