結果
| 問題 | No.133 カードゲーム | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2022-08-11 08:11:38 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 32 ms / 5,000 ms | 
| コード長 | 399 bytes | 
| コンパイル時間 | 119 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 10,880 KB | 
| 最終ジャッジ日時 | 2024-09-21 16:25:58 | 
| 合計ジャッジ時間 | 1,894 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 19 | 
ソースコード
import math
from itertools import permutations
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0
for a in permutations(A, N):
    for b in permutations(B, N):
        aw = 0
        for i in range(N):
            if a[i] > b[i]:
                aw += 1
        if aw > (N // 2):
            ans += 1
print(ans / (math.factorial(N) * math.factorial(N)))
            
            
            
        