結果
| 問題 | No.133 カードゲーム | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2021-03-11 14:21:09 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 45 ms / 5,000 ms | 
| コード長 | 415 bytes | 
| コンパイル時間 | 163 ms | 
| コンパイル使用メモリ | 82,092 KB | 
| 実行使用メモリ | 62,348 KB | 
| 最終ジャッジ日時 | 2024-10-13 02:47:24 | 
| 合計ジャッジ時間 | 1,897 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 19 | 
ソースコード
import math
import itertools
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
A=list(itertools.permutations(A))
B=list(itertools.permutations(B))
t=math.factorial(N)
ans=0
for i in range(t):
    for j in range(t):
        a=A[i];b=B[j]
        tmp=0
        for k in range(N):
            if a[k]>b[k]:
                tmp+=1
        if tmp>N//2:
            ans+=1
print(ans/(t**2))
            
            
            
        