結果
| 問題 | No.133 カードゲーム | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2022-03-02 01:34:58 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 27 ms / 5,000 ms | 
| コード長 | 528 bytes | 
| コンパイル時間 | 95 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 10,752 KB | 
| 最終ジャッジ日時 | 2024-07-08 08:37:12 | 
| 合計ジャッジ時間 | 1,512 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 19 | 
ソースコード
#カードゲーム
#https://yukicoder.me/problems/199
from itertools import permutations
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A_perm = list(permutations(A))
B_perm = list(permutations(B))
ans = 0
for a in A_perm:
    for b in B_perm:
        awin = 0
        bwin = 0
        for an,bn in zip(a,b):
            if an > bn:
                awin += 1
            else:
                bwin += 1
        if awin > bwin:
            ans += 1
print(ans/(len(A_perm)*len(B_perm)))
            
            
            
        