結果

問題 No.133 カードゲーム
ユーザー huka_hukahuka_huka
提出日時 2021-08-14 12:37:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 43 ms / 5,000 ms
コード長 432 bytes
コンパイル時間 796 ms
コンパイル使用メモリ 82,224 KB
実行使用メモリ 61,588 KB
最終ジャッジ日時 2024-10-05 03:55:32
合計ジャッジ時間 1,716 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

# yukicoder133
from math import factorial
from itertools import permutations
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
for a_order in permutations(a):
    for b_order in permutations(b):
        cnt = 0
        for i in range(n):
            if a_order[i] > b_order[i]:
                cnt += 1
        if cnt > n // 2:
            ans += 1
ans /= (factorial(n))**2
print(ans)
0