結果

問題 No.133 カードゲーム
ユーザー Chunky_RBP_ChanChunky_RBP_Chan
提出日時 2022-03-02 01:34:58
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 17 ms / 5,000 ms
コード長 528 bytes
コンパイル時間 77 ms
コンパイル使用メモリ 10,672 KB
実行使用メモリ 8,288 KB
最終ジャッジ日時 2023-09-22 17:15:22
合計ジャッジ時間 1,606 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,284 KB
testcase_01 AC 16 ms
8,104 KB
testcase_02 AC 16 ms
8,180 KB
testcase_03 AC 16 ms
8,272 KB
testcase_04 AC 16 ms
8,104 KB
testcase_05 AC 16 ms
8,152 KB
testcase_06 AC 16 ms
8,192 KB
testcase_07 AC 16 ms
8,072 KB
testcase_08 AC 16 ms
8,104 KB
testcase_09 AC 16 ms
8,096 KB
testcase_10 AC 17 ms
8,164 KB
testcase_11 AC 16 ms
8,092 KB
testcase_12 AC 16 ms
8,248 KB
testcase_13 AC 16 ms
8,268 KB
testcase_14 AC 16 ms
8,084 KB
testcase_15 AC 16 ms
8,280 KB
testcase_16 AC 16 ms
8,164 KB
testcase_17 AC 16 ms
8,072 KB
testcase_18 AC 16 ms
8,072 KB
testcase_19 AC 16 ms
8,092 KB
testcase_20 AC 17 ms
8,080 KB
testcase_21 AC 16 ms
8,288 KB
testcase_22 AC 16 ms
8,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#カードゲーム
#https://yukicoder.me/problems/199
from itertools import permutations

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A_perm = list(permutations(A))
B_perm = list(permutations(B))
ans = 0
for a in A_perm:
    for b in B_perm:
        awin = 0
        bwin = 0
        for an,bn in zip(a,b):
            if an > bn:
                awin += 1
            else:
                bwin += 1
        if awin > bwin:
            ans += 1
print(ans/(len(A_perm)*len(B_perm)))
0