結果

問題 No.133 カードゲーム
ユーザー daku9640daku9640
提出日時 2017-02-22 15:15:57
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 18 ms / 5,000 ms
コード長 457 bytes
コンパイル時間 80 ms
コンパイル使用メモリ 10,748 KB
実行使用メモリ 8,440 KB
最終ジャッジ日時 2023-09-07 09:30:41
合計ジャッジ時間 1,313 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
8,372 KB
testcase_01 AC 13 ms
8,364 KB
testcase_02 AC 14 ms
8,240 KB
testcase_03 AC 14 ms
8,228 KB
testcase_04 AC 14 ms
8,408 KB
testcase_05 AC 15 ms
8,252 KB
testcase_06 AC 14 ms
8,244 KB
testcase_07 AC 13 ms
8,244 KB
testcase_08 AC 13 ms
8,384 KB
testcase_09 AC 15 ms
8,416 KB
testcase_10 AC 14 ms
8,276 KB
testcase_11 AC 13 ms
8,240 KB
testcase_12 AC 14 ms
8,380 KB
testcase_13 AC 14 ms
8,300 KB
testcase_14 AC 13 ms
8,272 KB
testcase_15 AC 13 ms
8,392 KB
testcase_16 AC 14 ms
8,348 KB
testcase_17 AC 14 ms
8,396 KB
testcase_18 AC 15 ms
8,316 KB
testcase_19 AC 14 ms
8,292 KB
testcase_20 AC 18 ms
8,380 KB
testcase_21 AC 15 ms
8,232 KB
testcase_22 AC 15 ms
8,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import itertools
from math import factorial

n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]

scnt = 0
for i in itertools.permutations(a, n):
    for j in itertools.permutations(b, n):
        acnt = bcnt = 0
        for x, y in zip(i, j):
            if x > y: acnt += 1
            else: bcnt += 1
        if acnt > bcnt: scnt += 1

print(scnt / factorial(n) ** 2)
0