結果
| 問題 | No.133 カードゲーム | 
| コンテスト | |
| ユーザー |  nbisco | 
| 提出日時 | 2017-01-26 00:00:06 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 32 ms / 5,000 ms | 
| コード長 | 349 bytes | 
| コンパイル時間 | 98 ms | 
| コンパイル使用メモリ | 12,416 KB | 
| 実行使用メモリ | 10,752 KB | 
| 最終ジャッジ日時 | 2024-06-25 03:48:17 | 
| 合計ジャッジ時間 | 1,571 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 19 | 
ソースコード
import itertools
import math
N = int(input())
A = list(map(int, input().split(" ")))
B = list(map(int, input().split(" ")))
count = 0
total = 0
for b in itertools.permutations(B):
    wins = 0
    for i in range(N):
        wins += 1 if b[i] < A[i] else 0
    if wins > N//2:
        count += 1
fact = math.factorial(N)
print(float(count / fact))
            
            
            
        