結果

問題 No.133 カードゲーム
ユーザー tomatonosuketomatonosuke
提出日時 2019-04-11 01:20:19
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 653 bytes
コンパイル時間 69 ms
コンパイル使用メモリ 10,820 KB
実行使用メモリ 8,880 KB
最終ジャッジ日時 2023-09-22 21:17:15
合計ジャッジ時間 1,748 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 20 ms
8,656 KB
testcase_03 AC 21 ms
8,824 KB
testcase_04 AC 20 ms
8,760 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 19 ms
8,756 KB
testcase_09 AC 20 ms
8,656 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 20 ms
8,756 KB
testcase_15 AC 20 ms
8,656 KB
testcase_16 WA -
testcase_17 AC 21 ms
8,664 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
from itertools import permutations
from functools import reduce
length = int(input())
A = [int(n) for n in input().split(" ")]
B = [int(n) for n in input().split(" ")]
answer = 0
total = 0
for_win = int(math.ceil(length / 2))
for a_comb in permutations(A, length):
    for b_comb in permutations(B, length):
        temp_win = 0
        total += 1
        # print(a_comb, b_comb, for_win, total, answer)
        for i in range(length):
            if a_comb[i] > b_comb[i]:
                temp_win += 1
            if temp_win >= for_win:
                answer += 1
                break
                
            
print(answer / total)
0