結果

問題 No.133 カードゲーム
ユーザー DrDrpilotDrDrpilot
提出日時 2022-06-21 11:58:14
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 35 ms / 5,000 ms
コード長 618 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-22 06:04:50
合計ジャッジ時間 1,918 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

from itertools import permutations
from math import factorial
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
deno=0
for per_a in permutations(range(n)):
    tmp_a=[]
    for i in range(n):
        tmp_a.append(a[per_a[i]])
    for per_b in permutations(range(n)):
        tmp_b=[]
        cnt=0
        for i in range(n):
            tmp_b.append(b[per_b[i]])
        for i in range(n):
            if tmp_a[i]>tmp_b[i]:
                cnt+=1
        if (n==1 and cnt==1) or (n==2 and cnt==2) or (n==3 and cnt>=2) or (n==4 and cnt>=3):
            deno+=1
print(deno/factorial(n)**2)
0