結果
| 問題 | No.133 カードゲーム | 
| コンテスト | |
| ユーザー |  asumo0729 | 
| 提出日時 | 2021-04-23 00:32:16 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 54 ms / 5,000 ms | 
| コード長 | 555 bytes | 
| コンパイル時間 | 225 ms | 
| コンパイル使用メモリ | 82,432 KB | 
| 実行使用メモリ | 60,288 KB | 
| 最終ジャッジ日時 | 2024-07-04 06:37:50 | 
| 合計ジャッジ時間 | 2,073 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 19 | 
ソースコード
import sys
import itertools
stdin=sys.stdin
ip=lambda: int(sp())
fp=lambda: float(sp())
lp=lambda:list(map(int,stdin.readline().split()))
sp=lambda:stdin.readline().rstrip()
Yp=lambda:print('Yes')
Np=lambda:print('No')
N = ip()
A = lp()
B = lp()
P = list(itertools.permutations(A,N))
Q = list(itertools.permutations(B,N))
All = len(P) * len(Q)
win = 0
for a in P:
    for b in Q:
        res = 0
        for turn in range(N):
            if a[turn] > b[turn]:
                res += 1
        if res > N - res:
            win += 1
print(win / All)
            
            
            
        