結果

問題 No.133 カードゲーム
ユーザー huka_hukahuka_huka
提出日時 2021-08-14 12:37:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 49 ms / 5,000 ms
コード長 432 bytes
コンパイル時間 572 ms
コンパイル使用メモリ 82,124 KB
実行使用メモリ 61,132 KB
最終ジャッジ日時 2024-04-15 10:09:12
合計ジャッジ時間 2,570 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
52,928 KB
testcase_01 AC 40 ms
53,020 KB
testcase_02 AC 44 ms
53,456 KB
testcase_03 AC 41 ms
53,336 KB
testcase_04 AC 41 ms
52,868 KB
testcase_05 AC 46 ms
59,784 KB
testcase_06 AC 48 ms
61,132 KB
testcase_07 AC 47 ms
59,940 KB
testcase_08 AC 41 ms
53,208 KB
testcase_09 AC 42 ms
52,672 KB
testcase_10 AC 46 ms
59,900 KB
testcase_11 AC 47 ms
60,660 KB
testcase_12 AC 48 ms
60,348 KB
testcase_13 AC 40 ms
53,756 KB
testcase_14 AC 41 ms
52,604 KB
testcase_15 AC 40 ms
53,236 KB
testcase_16 AC 49 ms
60,784 KB
testcase_17 AC 46 ms
59,336 KB
testcase_18 AC 48 ms
60,976 KB
testcase_19 AC 48 ms
60,876 KB
testcase_20 AC 47 ms
60,912 KB
testcase_21 AC 49 ms
59,900 KB
testcase_22 AC 48 ms
60,556 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# yukicoder133
from math import factorial
from itertools import permutations
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
for a_order in permutations(a):
    for b_order in permutations(b):
        cnt = 0
        for i in range(n):
            if a_order[i] > b_order[i]:
                cnt += 1
        if cnt > n // 2:
            ans += 1
ans /= (factorial(n))**2
print(ans)
0