結果
| 問題 | No.133 カードゲーム | 
| コンテスト | |
| ユーザー |  makotokyoto | 
| 提出日時 | 2020-07-13 04:04:48 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 500 bytes | 
| コンパイル時間 | 381 ms | 
| コンパイル使用メモリ | 12,672 KB | 
| 実行使用メモリ | 11,008 KB | 
| 最終ジャッジ日時 | 2024-11-06 18:42:35 | 
| 合計ジャッジ時間 | 1,932 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 WA * 3 | 
| other | AC * 1 WA * 18 | 
ソースコード
from itertools import permutations
import math
N=int(input())                    #1<=N<=4
A=list(map(int,input().split()))  #1から2*Nまでのカードが存在する
B=list(map(int,input().split()))
a=permutations(A,N)
b=permutations(B,N)
n=math.factorial(N)
ans=0
for x in a :
    for y in b :
        win,lose=0,0
        for k in range(N) : 
            if x[k]>y[k] :
                win+=1
            else :
                lose+=1
        if win>lose :
            ans+=1
print(ans/n**2)
            
            
            
        