結果

問題 No.133 カードゲーム
ユーザー simansiman
提出日時 2020-11-19 16:21:27
言語 Ruby
(3.3.0)
結果
AC  
実行時間 91 ms / 5,000 ms
コード長 353 bytes
コンパイル時間 73 ms
コンパイル使用メモリ 11,516 KB
実行使用メモリ 15,676 KB
最終ジャッジ日時 2023-09-30 16:20:01
合計ジャッジ時間 3,912 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
15,468 KB
testcase_01 AC 86 ms
15,496 KB
testcase_02 AC 85 ms
15,632 KB
testcase_03 AC 85 ms
15,160 KB
testcase_04 AC 86 ms
15,532 KB
testcase_05 AC 89 ms
15,488 KB
testcase_06 AC 88 ms
15,512 KB
testcase_07 AC 88 ms
15,516 KB
testcase_08 AC 88 ms
15,464 KB
testcase_09 AC 90 ms
15,652 KB
testcase_10 AC 90 ms
15,460 KB
testcase_11 AC 89 ms
15,536 KB
testcase_12 AC 90 ms
15,656 KB
testcase_13 AC 86 ms
15,676 KB
testcase_14 AC 86 ms
15,444 KB
testcase_15 AC 85 ms
15,536 KB
testcase_16 AC 89 ms
15,524 KB
testcase_17 AC 86 ms
15,356 KB
testcase_18 AC 87 ms
15,564 KB
testcase_19 AC 88 ms
15,464 KB
testcase_20 AC 89 ms
15,552 KB
testcase_21 AC 91 ms
15,540 KB
testcase_22 AC 89 ms
15,552 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
A = gets.split.map(&:to_i)
B = gets.split.map(&:to_i)
total = 0
win = 0

[*0...N].permutation(N) do |listA|
  [*0...N].permutation(N) do |listB|
    total += 1
    win_cnt = 0

    listA.zip(listB) do |ia, ib|
      win_cnt += 1 if A[ia] > B[ib]
    end

    win += 1 if win_cnt > N / 2
  end
end

puts Rational(win, total).to_f.round(12)
0