結果

問題 No.133 カードゲーム
ユーザー ディグ田ディグ田
提出日時 2020-04-16 14:00:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 44 ms / 5,000 ms
コード長 435 bytes
コンパイル時間 298 ms
コンパイル使用メモリ 82,232 KB
実行使用メモリ 62,244 KB
最終ジャッジ日時 2024-04-09 19:10:36
合計ジャッジ時間 1,972 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,288 KB
testcase_01 AC 35 ms
52,068 KB
testcase_02 AC 33 ms
52,416 KB
testcase_03 AC 35 ms
52,248 KB
testcase_04 AC 34 ms
52,124 KB
testcase_05 AC 40 ms
60,844 KB
testcase_06 AC 41 ms
61,028 KB
testcase_07 AC 41 ms
59,680 KB
testcase_08 AC 34 ms
53,532 KB
testcase_09 AC 34 ms
53,152 KB
testcase_10 AC 44 ms
60,704 KB
testcase_11 AC 41 ms
59,952 KB
testcase_12 AC 42 ms
60,372 KB
testcase_13 AC 34 ms
53,600 KB
testcase_14 AC 36 ms
52,128 KB
testcase_15 AC 34 ms
52,132 KB
testcase_16 AC 41 ms
60,424 KB
testcase_17 AC 39 ms
60,828 KB
testcase_18 AC 40 ms
62,244 KB
testcase_19 AC 40 ms
60,136 KB
testcase_20 AC 41 ms
60,952 KB
testcase_21 AC 41 ms
60,636 KB
testcase_22 AC 39 ms
60,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a_rate_numerator = 0
count = 0

for a in itertools.permutations(A, n):
	for b in itertools.permutations(B, n):
		count += 1
		a_score = 0
		b_score = 0
		for i in range(n):
			if a[i] > b[i]:
				a_score += 1
			elif b[i] > a[i]:
				b_score += 1
		if a_score > b_score:
			a_rate_numerator += 1

print(a_rate_numerator / count)
0