結果

問題 No.133 カードゲーム
ユーザー IT_parselyIT_parsely
提出日時 2019-08-15 16:54:11
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 33 ms / 5,000 ms
コード長 551 bytes
コンパイル時間 152 ms
コンパイル使用メモリ 11,828 KB
実行使用メモリ 10,032 KB
最終ジャッジ日時 2023-10-19 19:07:21
合計ジャッジ時間 1,782 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import itertools

n = int(input())

A = list(map(int, input().split()))
B = list(map(int, input().split()))
game_count = 0
game_A = 0

for cards_a in list(itertools.permutations(A, n)):
    for cards_b in list(itertools.permutations(B, n)):
        win_a = 0
        win_b = 0
        for card_a, card_b in zip(cards_a, cards_b):
            if card_a > card_b:
                win_a += 1
            elif card_b > card_a:
                win_b += 1

        game_count += 1
        if win_a > win_b:
            game_A += 1

print(game_A/game_count)
0