結果

問題 No.133 カードゲーム
ユーザー ntudantuda
提出日時 2023-12-26 22:36:28
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 454 bytes
コンパイル時間 246 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 60,148 KB
最終ジャッジ日時 2023-12-26 22:36:30
合計ジャッジ時間 2,124 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,460 KB
testcase_01 AC 37 ms
53,460 KB
testcase_02 AC 35 ms
53,460 KB
testcase_03 AC 36 ms
53,460 KB
testcase_04 AC 35 ms
53,460 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 35 ms
53,460 KB
testcase_09 AC 34 ms
53,460 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 34 ms
53,460 KB
testcase_14 AC 34 ms
53,460 KB
testcase_15 AC 33 ms
53,460 KB
testcase_16 WA -
testcase_17 AC 38 ms
60,020 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
if N == 1:
    if A[0] > B[0]:
        print(1)
    else:
        print(0)
    exit()

win = 0
for a in permutations(A, N):
    for b in permutations(B, N):
        cnt = 0
        for i in range(N):
            if a[i] > b[i]:
                cnt += 1
        if cnt > N // 2:
            win += 1
print(win / (N * (N - 1))**2)
0