結果

問題 No.133 カードゲーム
ユーザー qibqib
提出日時 2023-05-01 01:31:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 83 ms / 5,000 ms
コード長 358 bytes
コンパイル時間 363 ms
コンパイル使用メモリ 86,424 KB
実行使用メモリ 76,504 KB
最終ジャッジ日時 2023-08-12 13:29:41
合計ジャッジ時間 3,662 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,216 KB
testcase_01 AC 73 ms
71,256 KB
testcase_02 AC 74 ms
70,996 KB
testcase_03 AC 71 ms
71,096 KB
testcase_04 AC 73 ms
71,328 KB
testcase_05 AC 79 ms
76,188 KB
testcase_06 AC 83 ms
76,504 KB
testcase_07 AC 79 ms
76,216 KB
testcase_08 AC 74 ms
71,352 KB
testcase_09 AC 72 ms
71,280 KB
testcase_10 AC 78 ms
76,364 KB
testcase_11 AC 77 ms
76,120 KB
testcase_12 AC 79 ms
76,440 KB
testcase_13 AC 72 ms
71,344 KB
testcase_14 AC 72 ms
71,284 KB
testcase_15 AC 72 ms
71,480 KB
testcase_16 AC 78 ms
76,432 KB
testcase_17 AC 78 ms
75,944 KB
testcase_18 AC 78 ms
75,932 KB
testcase_19 AC 78 ms
75,968 KB
testcase_20 AC 75 ms
76,072 KB
testcase_21 AC 79 ms
76,128 KB
testcase_22 AC 77 ms
76,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools as it
import math

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ans = 0
for pa in it.permutations(a, n):
  for pb in it.permutations(b, n):
    cnt = 0
    for i in range(n):
      if pa[i] > pb[i]:
        cnt += 1

    if cnt > n // 2:
      ans += 1

ans /= (math.factorial(n) ** 2)
print(ans)
0