結果
| 問題 | No.133 カードゲーム | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2021-01-01 00:31:39 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 52 ms / 5,000 ms | 
| コード長 | 341 bytes | 
| コンパイル時間 | 437 ms | 
| コンパイル使用メモリ | 82,176 KB | 
| 実行使用メモリ | 60,416 KB | 
| 最終ジャッジ日時 | 2024-10-10 01:35:43 | 
| 合計ジャッジ時間 | 2,586 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 19 | 
ソースコード
from itertools import permutations
from math import factorial
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
ans=0
for A_p in permutations(A,n):
  for B_p in permutations(B,n):
    cnt=0
    for i in range(n):
      if A_p[i]>B_p[i]:
        cnt+=1
    if cnt>n//2:
      ans+=1
print(ans/(factorial(n)**2))
            
            
            
        