結果

問題 No.133 カードゲーム
ユーザー lloyzlloyz
提出日時 2023-06-23 00:40:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 17 ms / 5,000 ms
コード長 530 bytes
コンパイル時間 489 ms
コンパイル使用メモリ 10,792 KB
実行使用メモリ 8,300 KB
最終ジャッジ日時 2023-09-12 18:41:56
合計ジャッジ時間 2,988 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,208 KB
testcase_01 AC 16 ms
8,156 KB
testcase_02 AC 16 ms
8,260 KB
testcase_03 AC 16 ms
8,264 KB
testcase_04 AC 16 ms
8,208 KB
testcase_05 AC 17 ms
8,144 KB
testcase_06 AC 16 ms
8,192 KB
testcase_07 AC 17 ms
8,224 KB
testcase_08 AC 16 ms
8,220 KB
testcase_09 AC 16 ms
8,112 KB
testcase_10 AC 17 ms
8,156 KB
testcase_11 AC 17 ms
8,168 KB
testcase_12 AC 17 ms
8,220 KB
testcase_13 AC 15 ms
8,300 KB
testcase_14 AC 16 ms
8,148 KB
testcase_15 AC 16 ms
8,148 KB
testcase_16 AC 16 ms
8,204 KB
testcase_17 AC 17 ms
8,252 KB
testcase_18 AC 17 ms
8,124 KB
testcase_19 AC 16 ms
8,128 KB
testcase_20 AC 17 ms
8,196 KB
testcase_21 AC 17 ms
8,208 KB
testcase_22 AC 17 ms
8,292 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations

n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

ans = 0
fact = 1
for i in range(1, n + 1):
    fact *= i
for P1 in permutations(range(n)):
    for P2 in permutations(range(n)):
        C = [0, 0]
        for i in range(n):
            p1i, p2i = P1[i], P2[i]
            if A[p1i] > B[p2i]:
                C[0] += 1
            elif A[p1i] < B[p2i]:
                C[1] += 1
        if C[0] > C[1]:
            ans += 1
ans /= fact * fact
print(ans)
0