結果

問題 No.133 カードゲーム
ユーザー Shiba-YouShiba-You
提出日時 2021-12-29 11:40:20
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 35 ms / 5,000 ms
コード長 574 bytes
コンパイル時間 84 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-04-14 17:21:00
合計ジャッジ時間 1,852 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,880 KB
testcase_01 AC 31 ms
10,752 KB
testcase_02 AC 31 ms
10,880 KB
testcase_03 AC 34 ms
10,880 KB
testcase_04 AC 35 ms
10,752 KB
testcase_05 AC 34 ms
11,008 KB
testcase_06 AC 31 ms
10,880 KB
testcase_07 AC 32 ms
10,880 KB
testcase_08 AC 31 ms
10,880 KB
testcase_09 AC 32 ms
10,880 KB
testcase_10 AC 31 ms
10,880 KB
testcase_11 AC 31 ms
10,880 KB
testcase_12 AC 31 ms
10,880 KB
testcase_13 AC 30 ms
11,008 KB
testcase_14 AC 31 ms
10,880 KB
testcase_15 AC 34 ms
10,880 KB
testcase_16 AC 31 ms
10,880 KB
testcase_17 AC 31 ms
10,752 KB
testcase_18 AC 31 ms
11,008 KB
testcase_19 AC 31 ms
10,880 KB
testcase_20 AC 31 ms
10,880 KB
testcase_21 AC 31 ms
10,880 KB
testcase_22 AC 32 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0