結果

問題 No.133 カードゲーム
ユーザー zombietanzombietan
提出日時 2016-05-23 23:56:19
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 33 ms / 5,000 ms
コード長 429 bytes
コンパイル時間 119 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-06-25 03:43:43
合計ジャッジ時間 1,619 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

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

n = math.factorial(N)**2
c = 0
for a in itertools.permutations(A):
    for b in itertools.permutations(B):
        aw, bw = 0, 0
        for j, k in zip(a,b):
            if j > k:
                aw += 1
            else:
                bw += 1
        if aw > bw:
            c += 1
        
print(c/n)     
0