結果

問題 No.133 カードゲーム
ユーザー nbisconbisco
提出日時 2017-01-26 00:00:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 15 ms / 5,000 ms
コード長 349 bytes
コンパイル時間 832 ms
コンパイル使用メモリ 10,600 KB
実行使用メモリ 8,388 KB
最終ジャッジ日時 2023-09-07 09:30:31
合計ジャッジ時間 1,584 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
8,280 KB
testcase_01 AC 13 ms
8,224 KB
testcase_02 AC 14 ms
8,332 KB
testcase_03 AC 13 ms
8,368 KB
testcase_04 AC 13 ms
8,192 KB
testcase_05 AC 14 ms
8,156 KB
testcase_06 AC 14 ms
8,332 KB
testcase_07 AC 14 ms
8,240 KB
testcase_08 AC 15 ms
8,368 KB
testcase_09 AC 13 ms
8,388 KB
testcase_10 AC 13 ms
8,336 KB
testcase_11 AC 13 ms
8,200 KB
testcase_12 AC 13 ms
8,268 KB
testcase_13 AC 14 ms
8,332 KB
testcase_14 AC 14 ms
8,276 KB
testcase_15 AC 12 ms
8,192 KB
testcase_16 AC 13 ms
8,224 KB
testcase_17 AC 13 ms
8,328 KB
testcase_18 AC 13 ms
8,196 KB
testcase_19 AC 13 ms
8,280 KB
testcase_20 AC 13 ms
8,384 KB
testcase_21 AC 13 ms
8,264 KB
testcase_22 AC 14 ms
8,268 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
import math

N = int(input())
A = list(map(int, input().split(" ")))
B = list(map(int, input().split(" ")))

count = 0
total = 0
for b in itertools.permutations(B):
    wins = 0
    for i in range(N):
        wins += 1 if b[i] < A[i] else 0
    if wins > N//2:
        count += 1

fact = math.factorial(N)
print(float(count / fact))
0