結果

問題 No.133 カードゲーム
ユーザー te-sh
提出日時 2017-01-31 14:49:51
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 352 bytes
コンパイル時間 2,439 ms
コンパイル使用メモリ 164,520 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-12 06:47:36
合計ジャッジ時間 3,218 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

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

void main()
{
  auto n = readln.chomp.to!size_t;
  auto ai = readln.split.to!(int[]);
  auto bi = readln.split.to!(int[]);

  auto c = bi.permutations.count!(ci => zip(ai, ci).count!"a[0] > a[1]" > n / 2);
  writefln("%.3f", c.to!real / n.to!int.iota.map!"a + 1".fold!("a * b")(1));
}
0