結果

問題 No.133 カードゲーム
コンテスト
ユーザー t-rryyyoooo
提出日時 2019-09-07 02:37:18
言語 Python3
(3.14.3 + numpy 2.4.2 + scipy 1.17.0)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 527 ms / 5,000 ms
コード長 522 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 358 ms
コンパイル使用メモリ 20,828 KB
実行使用メモリ 35,316 KB
最終ジャッジ日時 2026-03-11 06:47:08
合計ジャッジ時間 14,495 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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