結果

問題 No.133 カードゲーム
ユーザー 310icecrystal310icecrystal
提出日時 2023-07-13 04:05:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 83 ms / 5,000 ms
コード長 501 bytes
コンパイル時間 1,493 ms
コンパイル使用メモリ 86,972 KB
実行使用メモリ 76,624 KB
最終ジャッジ日時 2023-10-12 17:41:32
合計ジャッジ時間 3,347 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,104 KB
testcase_01 AC 70 ms
71,360 KB
testcase_02 AC 72 ms
71,300 KB
testcase_03 AC 72 ms
71,352 KB
testcase_04 AC 74 ms
71,396 KB
testcase_05 AC 81 ms
76,512 KB
testcase_06 AC 83 ms
76,600 KB
testcase_07 AC 82 ms
76,492 KB
testcase_08 AC 74 ms
71,312 KB
testcase_09 AC 72 ms
71,312 KB
testcase_10 AC 79 ms
76,456 KB
testcase_11 AC 80 ms
76,160 KB
testcase_12 AC 79 ms
76,536 KB
testcase_13 AC 72 ms
71,384 KB
testcase_14 AC 76 ms
71,256 KB
testcase_15 AC 75 ms
71,392 KB
testcase_16 AC 83 ms
76,472 KB
testcase_17 AC 80 ms
76,092 KB
testcase_18 AC 82 ms
76,508 KB
testcase_19 AC 79 ms
76,624 KB
testcase_20 AC 76 ms
76,604 KB
testcase_21 AC 77 ms
76,464 KB
testcase_22 AC 77 ms
76,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

import itertools
patterns_A = list(itertools.permutations(A))
patterns_B = list(itertools.permutations(B))

win_count = 0
for p_A in patterns_A:
    for p_B in patterns_B:
        win_count_in_this_game = 0
        for i in range(N):
            win_count_in_this_game += (p_A[i] > p_B[i])
        if win_count_in_this_game * 2 > N:
            win_count += 1
import math
print(win_count / (math.factorial(N)**2))
0