結果

問題 No.133 カードゲーム
ユーザー tk
提出日時 2020-06-17 11:54:50
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 32 ms / 5,000 ms
コード長 488 bytes
コンパイル時間 108 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-07-03 12:09:13
合計ジャッジ時間 1,636 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline = sys.stdin.readline
from itertools import permutations
from math import factorial

def main():
    N = int(readline())
    A = list(map(int, readline().split()))
    B = list(map(int, readline().split()))
    cnt = 0
    
    for l1 in permutations(A, N):
        for l2 in permutations(B, N):
            if len([1 for a, b in zip(l1, l2) if a > b]) > N/2:
                cnt += 1
     
  
    print(cnt / (factorial(N) ** 2))

if __name__ == "__main__":
    main()
0