結果
| 問題 | No.133 カードゲーム | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2019-10-26 15:15:37 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 32 ms / 5,000 ms | 
| コード長 | 504 bytes | 
| コンパイル時間 | 126 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 10,880 KB | 
| 最終ジャッジ日時 | 2024-09-14 08:45:11 | 
| 合計ジャッジ時間 | 1,650 ms | 
| ジャッジサーバーID (参考情報) | judge6 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| 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()))
win_cnt = 0
for a in itertools.permutations(A , N):
    for b in itertools.permutations(B , N):
        a_victory = 0
        b_victory = 0
        for i in range(N):
            if a[i] > b[i]:
                a_victory += 1
            elif a[i] < b[i]:
                b_victory += 1
        if a_victory > b_victory:
            win_cnt += 1
print(win_cnt / math.factorial(N) ** 2)
            
            
            
        