結果

問題 No.133 カードゲーム
ユーザー t-rryyyoooot-rryyyoooo
提出日時 2019-09-07 02:37:18
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 144 ms / 5,000 ms
コード長 522 bytes
コンパイル時間 161 ms
コンパイル使用メモリ 10,924 KB
実行使用メモリ 29,776 KB
最終ジャッジ日時 2023-09-07 07:44:43
合計ジャッジ時間 6,741 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
29,648 KB
testcase_01 AC 133 ms
29,600 KB
testcase_02 AC 133 ms
29,732 KB
testcase_03 AC 134 ms
29,768 KB
testcase_04 AC 137 ms
29,716 KB
testcase_05 AC 137 ms
29,616 KB
testcase_06 AC 137 ms
29,724 KB
testcase_07 AC 137 ms
29,696 KB
testcase_08 AC 132 ms
29,772 KB
testcase_09 AC 133 ms
29,728 KB
testcase_10 AC 143 ms
29,720 KB
testcase_11 AC 142 ms
29,712 KB
testcase_12 AC 140 ms
29,612 KB
testcase_13 AC 134 ms
29,636 KB
testcase_14 AC 136 ms
29,604 KB
testcase_15 AC 133 ms
29,776 KB
testcase_16 AC 144 ms
29,732 KB
testcase_17 AC 140 ms
29,736 KB
testcase_18 AC 138 ms
29,744 KB
testcase_19 AC 139 ms
29,580 KB
testcase_20 AC 142 ms
29,772 KB
testcase_21 AC 139 ms
29,740 KB
testcase_22 AC 137 ms
29,632 KB
権限があれば一括ダウンロードができます

ソースコード

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