結果

問題 No.133 カードゲーム
ユーザー niodachi1niodachi1
提出日時 2020-02-10 11:27:47
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 35 ms / 5,000 ms
コード長 432 bytes
コンパイル時間 251 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 9,984 KB
最終ジャッジ日時 2024-04-08 12:52:35
合計ジャッジ時間 1,898 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import itertools

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

A_win = 0
B_win = 0

for A_play in itertools.permutations(A):
	for B_play in itertools.permutations(B):
		tmp_A_win = 0
		tmp_B_win = 0
		for i in range(N):
			if A_play[i] > B_play[i]:
				tmp_A_win += 1
			else:
				tmp_B_win += 1
		if tmp_A_win > tmp_B_win:
			A_win += 1
		else:
			B_win += 1

print(A_win/(A_win+B_win))
0