結果
| 問題 | No.133 カードゲーム | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2021-02-23 11:26:10 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 32 ms / 5,000 ms | 
| コード長 | 341 bytes | 
| コンパイル時間 | 258 ms | 
| コンパイル使用メモリ | 12,416 KB | 
| 実行使用メモリ | 10,880 KB | 
| 最終ジャッジ日時 | 2024-09-22 07:21:12 | 
| 合計ジャッジ時間 | 1,979 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 19 | 
ソースコード
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
import itertools
ap=itertools.permutations(a)
bp=itertools.permutations(b)
ans=0
for aa in ap:
  for bb in bp:
    temp=0
    for aii,bii in zip(aa,bb):
      if aii>bii:
        temp+=1
    if n/2<temp:
      ans+=1
import math
print(ans/math.factorial(n))
            
            
            
        