結果
| 問題 | No.133 カードゲーム | 
| コンテスト | |
| ユーザー |  310icecrystal | 
| 提出日時 | 2023-07-13 04:05:05 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 52 ms / 5,000 ms | 
| コード長 | 501 bytes | 
| コンパイル時間 | 290 ms | 
| コンパイル使用メモリ | 82,048 KB | 
| 実行使用メモリ | 60,288 KB | 
| 最終ジャッジ日時 | 2024-09-14 16:12:20 | 
| 合計ジャッジ時間 | 2,358 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 19 | 
ソースコード
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
import itertools
patterns_A = list(itertools.permutations(A))
patterns_B = list(itertools.permutations(B))
win_count = 0
for p_A in patterns_A:
    for p_B in patterns_B:
        win_count_in_this_game = 0
        for i in range(N):
            win_count_in_this_game += (p_A[i] > p_B[i])
        if win_count_in_this_game * 2 > N:
            win_count += 1
import math
print(win_count / (math.factorial(N)**2))
            
            
            
        