結果

問題 No.133 カードゲーム
ユーザー Ratstar216Ratstar216
提出日時 2023-09-08 20:06:45
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 30 ms / 5,000 ms
コード長 401 bytes
コンパイル時間 458 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-06-26 12:58:35
合計ジャッジ時間 1,723 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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()))
c = 0
for aa in permutations(a):
    for bb in permutations(b):
        aw = 0
        for i in range(n):
            aw += (aa[i] > bb[i])
        if aw > n / 2:
            c += 1
fac = [1] * (n + 1)
for i in range(n):
    fac[i + 1] = fac[i] * (i + 1)
print(c / (fac[n] ** 2))
0