結果

問題 No.133 カードゲーム
ユーザー zombietanzombietan
提出日時 2016-05-23 23:56:19
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 18 ms / 5,000 ms
コード長 429 bytes
コンパイル時間 79 ms
コンパイル使用メモリ 10,776 KB
実行使用メモリ 8,416 KB
最終ジャッジ日時 2023-09-07 09:25:48
合計ジャッジ時間 1,354 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
8,256 KB
testcase_01 AC 13 ms
8,352 KB
testcase_02 AC 14 ms
8,344 KB
testcase_03 AC 13 ms
8,360 KB
testcase_04 AC 14 ms
8,260 KB
testcase_05 AC 15 ms
8,412 KB
testcase_06 AC 15 ms
8,340 KB
testcase_07 AC 15 ms
8,416 KB
testcase_08 AC 14 ms
8,196 KB
testcase_09 AC 14 ms
8,192 KB
testcase_10 AC 13 ms
8,196 KB
testcase_11 AC 14 ms
8,260 KB
testcase_12 AC 15 ms
8,380 KB
testcase_13 AC 13 ms
8,256 KB
testcase_14 AC 12 ms
8,208 KB
testcase_15 AC 13 ms
8,392 KB
testcase_16 AC 15 ms
8,196 KB
testcase_17 AC 18 ms
8,392 KB
testcase_18 AC 15 ms
8,372 KB
testcase_19 AC 13 ms
8,372 KB
testcase_20 AC 14 ms
8,192 KB
testcase_21 AC 14 ms
8,192 KB
testcase_22 AC 13 ms
8,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
import math
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

n = math.factorial(N)**2
c = 0
for a in itertools.permutations(A):
    for b in itertools.permutations(B):
        aw, bw = 0, 0
        for j, k in zip(a,b):
            if j > k:
                aw += 1
            else:
                bw += 1
        if aw > bw:
            c += 1
        
print(c/n)     
0