結果

問題 No.133 カードゲーム
ユーザー t-rryyyoooot-rryyyoooo
提出日時 2019-09-07 02:37:18
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 583 ms / 5,000 ms
コード長 522 bytes
コンパイル時間 237 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 44,472 KB
最終ジャッジ日時 2024-06-25 02:05:24
合計ジャッジ時間 16,137 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
import math
import numpy as np


N = int(input())

a = list(map(int, input().split()))
b = list(map(int, input().split()))

per1 = list(itertools.permutations(list(range(N)), N))
per2 = list(itertools.permutations(list(range(N)), N))
cnt = 0
count = 0
c = 0
for x in per1:
    for y in per2:
        aa = np.array([ a[l] for l in x])
        bb = np.array([ b[m] for m in y])

        if np.where(aa>bb, True, False).sum() > N/2:
            count += 1


ans = count / math.factorial(N) ** 2
print(ans)


0