結果
| 問題 | No.133 カードゲーム | 
| コンテスト | |
| ユーザー |  titia | 
| 提出日時 | 2022-02-23 01:19:36 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 33 ms / 5,000 ms | 
| コード長 | 466 bytes | 
| コンパイル時間 | 107 ms | 
| コンパイル使用メモリ | 12,672 KB | 
| 実行使用メモリ | 10,880 KB | 
| 最終ジャッジ日時 | 2024-07-01 00:50:39 | 
| 合計ジャッジ時間 | 1,638 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 19 | 
ソースコード
from itertools import permutations
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
X=permutations(range(N))
Y=permutations(range(N))
win=0
other=0
for x in X:
    for y in Y:
        a=0
        b=0
        for i in range(N):
            if A[x[i]]>B[y[i]]:
                a+=1
            elif A[x[i]]<B[y[i]]:
                b+=1
        if a>b:
            win+=1
        else:
            other+=1
print(win/(win+other))
            
            
            
        