結果
問題 | No.133 カードゲーム |
ユーザー |
|
提出日時 | 2015-06-11 13:52:45 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 12 ms / 5,000 ms |
コード長 | 467 bytes |
コンパイル時間 | 288 ms |
コンパイル使用メモリ | 7,068 KB |
実行使用メモリ | 6,656 KB |
最終ジャッジ日時 | 2024-06-25 03:33:00 |
合計ジャッジ時間 | 1,280 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
# -*- coding:utf-8 -*- import itertools import math if __name__ == "__main__": n = input() A = map(int,raw_input().split()) B = map(int,raw_input().split()) A.sort() B.sort() ans = 0 for element_b in itertools.permutations(B,n): for element_a in itertools.permutations(A,n): temp = 0 for a,b in zip(element_a,element_b): if a > b: temp += 1 else: temp -= 1 if temp > 0: ans += 1 print ans / float(pow(math.factorial(n),2))