結果
| 問題 | No.133 カードゲーム | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2021-12-29 11:40:20 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 32 ms / 5,000 ms | 
| コード長 | 574 bytes | 
| コンパイル時間 | 257 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 11,008 KB | 
| 最終ジャッジ日時 | 2024-10-03 18:06:51 | 
| 合計ジャッジ時間 | 2,121 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 19 | 
ソースコード
from math import factorial
import itertools
def init():
  n = int(input())
  A = map(int, input().split())
  A = list(itertools.permutations(A))
  B = map(int, input().split())
  B = list(itertools.permutations(B))
  return A, B
def fullsearch():
  A, B = init()
  win = 0
  for a, b in itertools.product(A, B):
    a_crt = 0
    b_crt = 0
    for _a, _b in zip(a, b):
      if _b < _a:
        a_crt += 1
      else:
        b_crt += 1
    if b_crt < a_crt:
      win += 1
  ans = win / len(A)**2
  return ans
if __name__ == "__main__":
  ans = fullsearch()
  print(ans)
            
            
            
        