結果

問題 No.133 カードゲーム
ユーザー 0039hm
提出日時 2025-10-18 18:12:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 44 ms / 5,000 ms
コード長 496 bytes
コンパイル時間 478 ms
コンパイル使用メモリ 82,608 KB
実行使用メモリ 62,052 KB
最終ジャッジ日時 2025-10-18 18:12:13
合計ジャッジ時間 2,665 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import combinations, permutations, product
from math import factorial


n=int(input())
al=list(map(int,input().split()))
bl=list(map(int,input().split()))

cnt=0
for ao in permutations(al):
    for bo in permutations(bl):
        win=0
        lose=0
        for i in range(n):
            if ao[i]>bo[i]:
                win+=1
            elif ao[i]<bo[i]:
                lose+=1
        if win>lose:
            cnt+=1

allpattern=factorial(n)**2
print(cnt/allpattern)








0