結果
| 問題 | No.133 カードゲーム | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2016-10-05 11:09:57 | 
| 言語 | Python2 (2.7.18) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 14 ms / 5,000 ms | 
| コード長 | 328 bytes | 
| コンパイル時間 | 546 ms | 
| コンパイル使用メモリ | 6,912 KB | 
| 実行使用メモリ | 6,784 KB | 
| 最終ジャッジ日時 | 2024-06-25 03:44:44 | 
| 合計ジャッジ時間 | 1,497 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 19 | 
ソースコード
from itertools import permutations
N = input()
A = map(int, raw_input().split())
B = map(int, raw_input().split())
ans = 0
for a in permutations(A):
    for b in permutations(B):
        if sum(c>d for c,d in zip(a,b)) > sum(d>c for c,d in zip(a,b)):
            ans += 1
print ans/reduce(lambda x,y:x*y, range(1, N+1), 1.0)**2
            
            
            
        