結果

問題 No.133 カードゲーム
ユーザー DoubleM
提出日時 2021-05-13 18:57:01
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 32 ms / 5,000 ms
コード長 427 bytes
コンパイル時間 216 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-09-25 07:23:52
合計ジャッジ時間 1,607 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

battle = 0
totalWin = 0
for a in itertools.permutations(A, len(A)):
    for b in itertools.permutations(B, len(B)):
        battle += 1
        count = 0
        for i in range(N):
            if a[i] > b[i]:
                count += 1
        if count >= (N // 2 + 1):
            totalWin += 1

print(totalWin/battle)
0