結果

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

ソースコード

diff #

import itertools
import math

def read_data():
    N = int(input())
    As = list(map(int, input().split()))
    Bs = list(map(int, input().split()))
    return N, As, Bs

def solve(N, As, Bs):
    n_win = 0
    for bs in itertools.permutations(Bs):
        if len([1 for a, b in zip(As, bs) if a > b]) > N // 2:
            n_win += 1
    return 1.0 * n_win / math.factorial(N)

N, As, Bs = read_data()
print(solve(N, As, Bs))
0