結果

問題 No.133 カードゲーム
コンテスト
ユーザー TT TT
提出日時 2025-11-10 19:34:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 39 ms / 5,000 ms
コード長 373 bytes
コンパイル時間 323 ms
コンパイル使用メモリ 82,780 KB
実行使用メモリ 53,972 KB
最終ジャッジ日時 2025-11-10 19:34:56
合計ジャッジ時間 2,469 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations

N = int(input())

A = list(map(int, input().split()))
B = list(map(int, input().split()))

perm = permutations(A, N)

ans = [0, 0]

for a in perm:
  cnt = [0, 0]
  for i in range(N):
    if a[i] > B[i]:
      cnt[0] += 1
    else:
      cnt[1] += 1
  if cnt[0] > cnt[1]:
    ans[0] += 1
  else:
    ans[1] += 1

print(ans[0] / sum(ans))
0