結果
| 問題 | No.133 カードゲーム | 
| コンテスト | |
| ユーザー |  あかりき | 
| 提出日時 | 2021-02-23 20:31:53 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 46 ms / 5,000 ms | 
| コード長 | 370 bytes | 
| コンパイル時間 | 191 ms | 
| コンパイル使用メモリ | 82,444 KB | 
| 実行使用メモリ | 62,140 KB | 
| 最終ジャッジ日時 | 2024-09-22 14:54:46 | 
| 合計ジャッジ時間 | 1,973 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 19 | 
ソースコード
import itertools
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
l=[i for i in range(n)]
l2=list(itertools.permutations(l))
ans=0
for i in range(len(l2)):
  for j in range(len(l2)):
    ct=0
    for k in range(n):
      if a[l2[i][k]]>b[l2[j][k]]:
        ct+=1
      else:
        ct-=1
    if ct>0:
      ans+=1
print(ans/(len(l2)**2))
            
            
            
        