結果

問題 No.133 カードゲーム
ユーザー makotokyoto
提出日時 2020-07-13 04:06:51
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 32 ms / 5,000 ms
コード長 528 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-11-06 18:44:53
合計ジャッジ時間 1,818 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

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 permutations(A) :
    for y in permutations(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)
0