結果

問題 No.133 カードゲーム
ユーザー gorugo30gorugo30
提出日時 2021-03-05 18:52:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 60 ms / 5,000 ms
コード長 505 bytes
コンパイル時間 207 ms
コンパイル使用メモリ 82,816 KB
実行使用メモリ 61,440 KB
最終ジャッジ日時 2024-04-16 06:58:11
合計ジャッジ時間 2,374 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
52,096 KB
testcase_01 AC 47 ms
51,840 KB
testcase_02 AC 43 ms
52,096 KB
testcase_03 AC 43 ms
52,096 KB
testcase_04 AC 43 ms
52,096 KB
testcase_05 AC 55 ms
60,800 KB
testcase_06 AC 60 ms
61,056 KB
testcase_07 AC 54 ms
60,544 KB
testcase_08 AC 46 ms
52,096 KB
testcase_09 AC 45 ms
52,224 KB
testcase_10 AC 56 ms
60,928 KB
testcase_11 AC 55 ms
60,672 KB
testcase_12 AC 56 ms
61,312 KB
testcase_13 AC 44 ms
52,096 KB
testcase_14 AC 45 ms
52,480 KB
testcase_15 AC 46 ms
51,712 KB
testcase_16 AC 60 ms
61,312 KB
testcase_17 AC 55 ms
60,160 KB
testcase_18 AC 58 ms
61,312 KB
testcase_19 AC 54 ms
61,056 KB
testcase_20 AC 54 ms
60,416 KB
testcase_21 AC 56 ms
61,440 KB
testcase_22 AC 59 ms
61,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
l = [i for i in range(N)]
A = list(map(int, input().split()))
B = list(map(int, input().split()))

from itertools import permutations
ans = 0
facn = 1
for i in range(N):
    facn *= i + 1
for pA in permutations(l):
    for pB in permutations(l):
        cntA = 0
        cntB = 0
        for i, j in zip(pA, pB):
            if A[i] > B[j]:
                cntA += 1
            if A[i] < B[j]:
                cntB += 1
        if cntA > cntB:
            ans += 1 / facn ** 2
print(ans)
0