結果

問題 No.133 カードゲーム
コンテスト
ユーザー tonnnura172
提出日時 2019-06-20 10:22:10
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 866 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 594 ms
コンパイル使用メモリ 20,704 KB
実行使用メモリ 21,172 KB
最終ジャッジ日時 2026-05-26 07:24:43
合計ジャッジ時間 7,591 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 4
other RE * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = LIST()
B = LIST()

count = 0
A_perm = permutations(A)
for i in A_perm:
	A_win = 0
	B_win = 0
	for j in range(N):
		if i[j] > B[j]:  # Aの勝ち
			A_win += 1
		elif i[j] < B[j]:
			B_win += 1
	if A_win > B_win:
		count += 1

print(count/factorial(N))
0