結果

問題 No.133 カードゲーム
ユーザー hiremasahiremasa
提出日時 2022-02-12 00:08:52
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 33 ms / 5,000 ms
コード長 492 bytes
コンパイル時間 87 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-06-27 22:51:52
合計ジャッジ時間 1,754 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
import math
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0
for comb_a in itertools.permutations(range(N)):
    for comb_b in itertools.permutations(range(N)):
        a_win, b_win = 0, 0
        for i in range(N):
            if A[comb_a[i]] > B[comb_b[i]]:
                a_win += 1
            elif A[comb_a[i]] < B[comb_b[i]]:
                b_win += 1
        if a_win > b_win: ans += 1
print(ans/math.factorial(N)**2)
0