結果

問題 No.133 カードゲーム
コンテスト
ユーザー Akiyoshi Ohtani
提出日時 2020-08-05 20:45:27
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 35 ms / 5,000 ms
コード長 536 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 403 ms
コンパイル使用メモリ 84,992 KB
実行使用メモリ 61,184 KB
最終ジャッジ日時 2026-04-06 06:31:32
合計ジャッジ時間 1,747 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def backtrack(res, path):
    if len(path) == N:
        res.append(path)
        return
    for i in range(N):
        if i in path:
            continue
        backtrack(res, path + [i])

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

resA = []
visited = set()
backtrack(resA, [])
resB = []
visited = set()
backtrack(resB, [])

res = 0

for aL in resA:
    for bL in resB:
        res += N // 2 < sum(map(lambda pair: A[pair[0]] > B[pair[1]], zip(aL, bL)))

print(res/(len(resA)*len(resB)))
0